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

test: add vm-console-proxy functional tests #498

Merged
merged 1 commit into from
Feb 28, 2023
Merged

test: add vm-console-proxy functional tests #498

merged 1 commit into from
Feb 28, 2023

Conversation

codingben
Copy link
Member

What this PR does / why we need it:

This PR will add vm-console-proxy functional tests.

Release note:

Add vm-console-proxy functional tests

@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Feb 15, 2023
@akrejcir akrejcir added this to the v0.17.0 milestone Feb 16, 2023
tests/vm_console_proxy_test.go Outdated Show resolved Hide resolved
tests/vm_console_proxy_test.go Outdated Show resolved Hide resolved
@codingben codingben requested review from akrejcir and removed request for lyarwood and ksimon1 February 16, 2023 12:24
Copy link
Collaborator

@akrejcir akrejcir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make 2 commits in this PR? One will fix some bugs from the previous PR, like missing UpdateFuncs, and the other will add functional tests?

@codingben codingben requested a review from akrejcir February 16, 2023 15:22
tests/vm_console_proxy_test.go Show resolved Hide resolved
internal/operands/vm-console-proxy/reconcile.go Outdated Show resolved Hide resolved
internal/operands/vm-console-proxy/reconcile_test.go Outdated Show resolved Hide resolved
tests/tests_suite_test.go Outdated Show resolved Hide resolved
tests/vm_console_proxy_test.go Outdated Show resolved Hide resolved
tests/vm_console_proxy_test.go Outdated Show resolved Hide resolved
tests/vm_console_proxy_test.go Outdated Show resolved Hide resolved
@codingben
Copy link
Member Author

@akrejcir Thanks for the review, I'll take care of it on Sunday. Also I see this PR is affected by some issue:

error: unable to read URL "https://github.com/kubevirt/ssp-operator/releases/download/null/ssp-operator.yaml", server reported 404 Not Found

@lyarwood
Copy link
Member

@akrejcir Thanks for the review, I'll take care of it on Sunday. Also I see this PR is affected by some issue:

error: unable to read URL "https://github.com/kubevirt/ssp-operator/releases/download/null/ssp-operator.yaml", server reported 404 Not Found

Should be resolved, see #499

@akrejcir
Copy link
Collaborator

/retest

@codingben codingben requested a review from akrejcir February 19, 2023 13:21
@akrejcir
Copy link
Collaborator

The CI is timeouting. I've created a PR to increase the timeout: openshift/release#36544

internal/operands/vm-console-proxy/reconcile.go Outdated Show resolved Hide resolved
tests/vm_console_proxy_test.go Outdated Show resolved Hide resolved
tests/vm_console_proxy_test.go Outdated Show resolved Hide resolved
@codingben codingben requested a review from akrejcir February 20, 2023 11:56
@akrejcir
Copy link
Collaborator

/retest

@codingben codingben mentioned this pull request Feb 21, 2023
@codingben
Copy link
Member Author

@akrejcir Looks like it failed again because of timeout? I see it here [1]:

�[38;5;9m�[1mRan 61 of 266 Specs in 3600.077 seconds�[0m
�[38;5;9m�[1mFAIL! - Interrupted by Timeout�[0m -- �[38;5;10m�[1m60 Passed�[0m | �[38;5;9m�[1m1 Failed�[0m | �[38;5;11m�[1m1 Pending�[0m | �[38;5;14m�[1m204 Skipped�[0m

[1] https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/kubevirt_ssp-operator/498/pull-ci-kubevirt-ssp-operator-master-e2e-functests/1627959301203038208

@akrejcir
Copy link
Collaborator

Let's try again, maybe it takes a while until the configuration is applied.

/retest

@codingben
Copy link
Member Author

@akrejcir Okay. I see all *-apply jobs passed openshift/release@232d237.

@akrejcir
Copy link
Collaborator

The timeout was probably not set correctly. I've created another PR to fix it: openshift/release#36609

@akrejcir
Copy link
Collaborator

/retest

@lyarwood
Copy link
Member

I think the timeout here is coming from ginkgo itself right?

https://onsi.github.io/ginkgo/#recommended-continuous-integration-configuration

--timeout allows you to specify a timeout for the ginkgo run. The default duration is one hour, which may or may not be enough!

The fact we are still using go test to launch these tests and pass a timeout of 0 (unlimited?) is likely causing this to default to the 1 hour we are seeing.

go test -v -coverprofile cover.out -timeout 0 ./tests/...

@lyarwood
Copy link
Member

#504 - I wonder if this could help?

@lyarwood
Copy link
Member

lyarwood commented Feb 21, 2023

Okay I'm pretty sure this is a change in behaviour in v2 thanks to the following docs:

https://onsi.github.io/ginkgo/MIGRATING_TO_V2#timeout-behavior

Timeout Behavior

In Ginkgo V1.x, Ginkgo's timeout was managed by go test. This meant that timeouts exited the test suite abruptly with 
no opportunity for custom reporters or clean up code (e.g. AfterEach, AfterSuite) to run. This is fixed in V2. Ginkgo now 
manages its own timeout and when a timeout triggers the test winds down gracefully. In fact, a timeout is now 
functionally equivalent to a user-initiated interrupt.

In addition, in V1.x when running multiple test suites Ginkgo would give each suite the full timeout allotment (so ginkgo -
r -timeout=1h would give each test suite one hour to complete). In V2 the timeout now applies to the entire test suite run 
so that ginkgo -r -timeout=1h is now guaranteed to exit after (about) one hour.

Finally, the default timeout has been reduced from 24h down to 1h. Users with long-running tests may need to adjust the timeout in their CI scripts.

@akrejcir
Copy link
Collaborator

/lgtm
/approve

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Feb 23, 2023
@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: akrejcir

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

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 23, 2023
@codingben
Copy link
Member Author

Looks like it failed because of some internal error [1]:

Status: "Failure",
              Message: "Internal error occurred: failed calling webhook \"validation.ssp.kubevirt.io\": failed to call webhook: Post \"https://ssp-webhook-service.kubevirt.svc:443/validate-ssp-kubevirt-io-v1beta1-ssp?timeout=10s\": no endpoints available for service \"ssp-webhook-service\"",
              Reason: "InternalError",

[1] https://storage.googleapis.com/origin-ci-test/pr-logs/pull/kubevirt_ssp-operator/498/pull-ci-kubevirt-ssp-operator-master-e2e-upgrade-functests/1628771659840229376/build-log.txt

@codingben
Copy link
Member Author

/retest

@codingben
Copy link
Member Author

codingben commented Feb 24, 2023

Another timeout issue:

�[0mDataSources �[38;5;243mresource deletion �[0mrecreate after delete�[0m
  �[1m[test_id:4771]edit cluster role�[0m
  �[38;5;243m/go/src/github.com/kubevirt/ssp-operator/tests/dataSources_test.go:165�[0m
{"component":"entrypoint","file":"k8s.io/test-infra/prow/entrypoint/run.go:164","func":"k8s.io/test-infra/prow/entrypoint.Options.ExecuteProcess","level":"error","msg":"Process did not finish before 2h0m0s timeout","severity":"error","time":"2023-02-23T21:25:58Z"}

And:

�[0mMetrics �[38;5;243mSSP alerts rules�[0m
  �[1m[test_id:8955]should have all the required labels�[0m
  �[38;5;243m/go/src/github.com/kubevirt/ssp-operator/tests/metrics_test.go:277�[0m
{"component":"entrypoint","file":"k8s.io/test-infra/prow/entrypoint/run.go:164","func":"k8s.io/test-infra/prow/entrypoint.Options.ExecuteProcess","level":"error","msg":"Process did not finish before 2h0m0s timeout","severity":"error","time":"2023-02-23T21:37:46Z"}

@codingben
Copy link
Member Author

/test e2e-functests
/test e2e-single-node-functests

@kubevirt-bot
Copy link
Contributor

@codingben: No presubmit jobs available for kubevirt/ssp-operator@master

In response to this:

/test e2e-functests
/test e2e-single-node-functests

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.

return common.CreateOrUpdate(request).
ClusterResource(&serviceAccount).
WithAppLabels(operandName, operandComponent).
UpdateFunc(func(newRes, foundRes client.Object) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was mistaken about this change. The cluster adds a secret to the service account by default. This default field causes a reconciliation loop, and is removed again here in this function.

The loop means that SSP is always in a Deploying state. Curiously, the functional tests should fail after 10 minutes if Deployed state is not reached, but because of a race, sometimes the Deployed state is seen and that is enough for the test to progress.

Please remove this UpdateFunc().

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Makefile Outdated Show resolved Hide resolved
@kubevirt-bot kubevirt-bot removed the lgtm Indicates that a PR is ready to be merged. label Feb 27, 2023
@codingben codingben requested a review from akrejcir February 27, 2023 16:20
@akrejcir
Copy link
Collaborator

/retest

@codingben
Copy link
Member Author

It's failing now because of some weird error:

{  could not initialize namespace: failed to wait for authentication cache to warm up after 15s: projects.project.openshift.io "ci-op-ngsfcfg0" is forbidden: User "system:serviceaccount:ci:ci-operator" cannot get resource "projects" in API group "project.openshift.io" in the namespace "ci-op-ngsfcfg0"}

@codingben
Copy link
Member Author

/retest

@lyarwood
Copy link
Member

/retest-required

@akrejcir
Copy link
Collaborator

Retest will not help. I'm looking into it.

@akrejcir
Copy link
Collaborator

akrejcir commented Feb 28, 2023

And just to be safe of unexpected changes, can you make a DeepCopy() of all the objects used in Reconcile() function?
The shallow copies that are used now contain pointers, and can save some state from one reconciliation iteration to another.

Add vm-console-proxy functional tests.

Signed-off-by: Ben Oukhanov <[email protected]>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 28, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codingben
Copy link
Member Author

@akrejcir Thanks!

@akrejcir
Copy link
Collaborator

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Feb 28, 2023
@akrejcir
Copy link
Collaborator

/retest

1 similar comment
@akrejcir
Copy link
Collaborator

/retest

@codingben
Copy link
Member Author

/retest

@kubevirt-bot kubevirt-bot merged commit ccf3d9f into kubevirt:master Feb 28, 2023
@codingben codingben deleted the CNV-25394 branch June 28, 2023 14:22
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. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants