Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Backplane Console tests #359

Conversation

harliu-01
Copy link
Contributor

What type of PR is this?

unit-test

What this PR does / Why we need it?

This adds a series of unit tests for the console.go file

Which Jira/Github issue(s) does this PR fix?

OSD-20030

Resolves #
There has been a long standing issue with unit testing the console.go file, this commit adds a series of tests and some minor changes to console.go to ensure the use of mock interfaces for testing.

Special notes for your reviewer

Pre-checks (if applicable)

  • [x]Ran unit tests locally
  • Validated the changes in a cluster
  • Included documentation changes with PR

@openshift-ci openshift-ci bot requested review from supreeth7 and typeid March 4, 2024 08:47
@codecov-commenter
Copy link

codecov-commenter commented Mar 4, 2024

Codecov Report

Attention: Patch coverage is 47.50000% with 21 lines in your changes are missing coverage. Please review.

Project coverage is 48.27%. Comparing base (c2e36f1) to head (ae3c62b).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #359      +/-   ##
==========================================
+ Coverage   44.53%   48.27%   +3.74%     
==========================================
  Files          54       55       +1     
  Lines        4145     4182      +37     
==========================================
+ Hits         1846     2019     +173     
+ Misses       2034     1844     -190     
- Partials      265      319      +54     
Files Coverage Δ
cmd/ocm-backplane/console/console.go 44.59% <40.00%> (+21.27%) ⬆️
cmd/ocm-backplane/console/console_tests_util.go 48.57% <48.57%> (ø)

@harliu-01 harliu-01 force-pushed the harliu-console-tests-interfaces branch from 0572b21 to b47c395 Compare March 5, 2024 08:32
Added tests for validatecontainer engine, getcontainerengineimpl and the run function.

Added isTest flag to console options to prevent the occurance of an infinite loop

Added tests for cleanup function for console options

Added an additional test for ports

"Remove test for cleanup function"

Uncapitalize strings

Expect error from run command to be lower case

Split up the Validate Container Engine Tests

Added podman and docker into a temp path

Added exec permissions to temp file

Change order of errors

Implemented isTest flag in consoleOptions, this is a workaround since that environment varibles within contains cannot be changed, this purely

Incorperated validateContainerEngine into consoleOptions, this is due to some problems with containers and testing

Make changes in test for validateContainerEngine

Added missing method

Make lint changes to o.test flag

Roll back changes to validateContainerEngine

Added a functionality to mock the existence of a podman and docker binary, but they are actually just empty executable files in tmpfs

Made changes to the circuit breaker at run

Cleaned up some formatting issues

Added tests for ocm-backplane and made some formatting and syntax changes

Alternative workaround for console test of the run function in console.go via mock interfaces

Moved temp path configuration utilities in console_test to console_test_utils

added file console_tests_util.go

Added defensive code into cleanup and moved mockinterface into utils

Commenting

Removed uncessary comments
@harliu-01 harliu-01 force-pushed the harliu-console-tests-interfaces branch from b47c395 to ae3c62b Compare March 5, 2024 08:42
Copy link
Contributor

openshift-ci bot commented Mar 5, 2024

@rhs-harliu: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@samanthajayasinghe
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 5, 2024
Copy link
Contributor

openshift-ci bot commented Mar 5, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhs-harliu, samanthajayasinghe

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 5, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit ce4be02 into openshift:main Mar 5, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants