Skip to content

Conversation

@soltysh
Copy link
Contributor

@soltysh soltysh commented Sep 7, 2023

This PR does the following things at a high level:

  • cleans up test/extended/util/client.go to get rid of duplicate code and ensure all creation goes through the exact same path - single NewCLI method with a structure that allows you to configure the necessary variant
  • keep explicit separation between admin and user config files to allow easily switching users, without creating new copies of the same resources, which then leads to resources not being cleaned up
  • moves non-CLI helpers to their own files

kubeConfig, _, err = GetHypershiftManagementClusterConfigAndNamespace()
o.Expect(err).NotTo(o.HaveOccurred())
} else {
kubeConfig = KubeConfigPath()
Copy link
Contributor

Choose a reason for hiding this comment

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

CLIOptions should provide an indicator for

  1. use the global
  2. use this path
  3. use the hypershift thing above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, probably this comment along with the other about using With* methods should go together.

// KubeFramework to use, instead of creating a brand new one
KubeFramework *framework.Framework
// prefix for the created test namespace
BaseName string
Copy link
Contributor

Choose a reason for hiding this comment

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

seems like this and withoutnamespace should be mutually exclusive.

Copy link
Member

Choose a reason for hiding this comment

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

Do we really need to set BaseName when withoutnamespace is true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

BaseName is used as a UniqueName here: https://github.com/kubernetes/kubernetes/blob/24fbb13eafec665e6f4b64961930774babd8b6d1/test/e2e/framework/framework.go#L279-L282 we could not require it being set and allow it to be randomly generated when empty, especially that this f.UniqueName is used pretty heavily in some cases. So for now I'd prefer we just keep it in there 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added that information in the field description for now.


// NewCLI is responsible for creating a new CLI object for invoking OpenShift CLI,
// CliOptions allow customization of the created object.
func NewCLI(options CliOptions) *CLI {
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps you want NewCLI(opts ...Option)

type Option func(cliOptions) cliOptions

func withTestFramework(framework) Option
func withPSALevel(level) Option
func withoutNamespace() Option

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, especially that we already have a lot of these With* methods.

}
_, err := c.AdminKubeClient().CoreV1().Namespaces().Create(context.Background(), nsObject, metav1.CreateOptions{})
o.Expect(err).NotTo(o.HaveOccurred())
c.kubeFramework.AddNamespacesToDelete(nsObject)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the kubeframework wired in some way that requires us to contain it instead of creating an entirely separate thign?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have a few cases where we modify the internals of the test framework, and I didn't want to address that in this PR.

nc := *c
nc.configPath = c.adminConfigPath
return &nc
c.currentConfigPath = c.adminConfigPath
Copy link
Member

Choose a reason for hiding this comment

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

in case of multiple CLI modifications within a test, would it make sense to protect all these changes with mutexes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd leave it up to consumers to deal with that kind of changes. I can probably add a comment to NewCLI about not having these kind of guarantees.

func (c CLI) WithToken(token string) *CLI {
c.configPath = ""
func (c *CLI) WithToken(token string) *CLI {
c.currentConfigPath = ""
Copy link
Member

Choose a reason for hiding this comment

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

same comment above

})
o.Expect(err).NotTo(o.HaveOccurred())

err = c.setupNamespacePodSecurity(newNamespace)
Copy link
Member

Choose a reason for hiding this comment

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

Why we don't need this anymore?. Because we are already setting it to restricted in somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm squashing two methods into one, to ensure we always use the same code path, and clean all the resources after the tests.

// KubeFramework to use, instead of creating a brand new one
KubeFramework *framework.Framework
// prefix for the created test namespace
BaseName string
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need to set BaseName when withoutnamespace is true?

@soltysh
Copy link
Contributor Author

soltysh commented Sep 8, 2023

/refresh-status

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 1, 2023
@openshift-merge-robot
Copy link
Contributor

PR needs rebase.

Details

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.

@openshift-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 31, 2023
@openshift-bot
Copy link
Contributor

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Feb 17, 2024
@openshift-bot
Copy link
Contributor

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci openshift-ci bot closed this Mar 19, 2024
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 19, 2024

@openshift-bot: Closed this PR.

Details

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

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.

@soltysh soltysh reopened this Jul 2, 2024
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 2, 2024
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: soltysh

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

The pull request process is described here

Details 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 Jul 2, 2024
@soltysh soltysh removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Jul 4, 2024
@openshift-trt-bot
Copy link

Job Failure Risk Analysis for sha: cbcf49d

Job Name Failure Risk
pull-ci-openshift-origin-master-e2e-openstack-ovn IncompleteTests
Tests for this run (100) are below the historical average (2080): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-metal-ipi-ovn-ipv6 IncompleteTests
Tests for this run (20) are below the historical average (1905): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-metal-ipi-ovn IncompleteTests
Tests for this run (20) are below the historical average (2022): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-gcp-ovn-upgrade IncompleteTests
Tests for this run (103) are below the historical average (812): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-gcp-ovn-rt-upgrade IncompleteTests
Tests for this run (103) are below the historical average (867): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-gcp-ovn-builds IncompleteTests
Tests for this run (102) are below the historical average (984): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-gcp-ovn IncompleteTests
Tests for this run (102) are below the historical average (1877): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-gcp-csi IncompleteTests
Tests for this run (102) are below the historical average (834): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-baremetalds-kubevirt IncompleteTests
Tests for this run (22) are below the historical average (580): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-aws-ovn-upgrade IncompleteTests
Tests for this run (104) are below the historical average (935): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-aws-ovn-single-node-upgrade IncompleteTests
Tests for this run (103) are below the historical average (2748): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-aws-ovn-single-node-serial IncompleteTests
Tests for this run (102) are below the historical average (893): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-aws-ovn-single-node IncompleteTests
Tests for this run (102) are below the historical average (2047): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-aws-ovn-serial IncompleteTests
Tests for this run (102) are below the historical average (952): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-aws-ovn-ipsec-serial IncompleteTests
Tests for this run (104) are below the historical average (436): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-aws-ovn-fips IncompleteTests
Tests for this run (102) are below the historical average (2024): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-aws-ovn-edge-zones IncompleteTests
Tests for this run (103) are below the historical average (2190): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-aws-ovn-cgroupsv2 IncompleteTests
Tests for this run (102) are below the historical average (1993): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-aws-csi IncompleteTests
Tests for this run (102) are below the historical average (856): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-agnostic-ovn-cmd IncompleteTests
Tests for this run (102) are below the historical average (839): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 19, 2024

@soltysh: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-ovn-image-ecosystem e8ded07 link true /test e2e-gcp-ovn-image-ecosystem
ci/prow/e2e-aws-ovn-upgrade 2d3fb70 link false /test e2e-aws-ovn-upgrade
ci/prow/e2e-aws-ovn-ipsec-serial 2d3fb70 link false /test e2e-aws-ovn-ipsec-serial
ci/prow/e2e-gcp-ovn-builds 2d3fb70 link true /test e2e-gcp-ovn-builds
ci/prow/e2e-aws-ovn-edge-zones 2d3fb70 link true /test e2e-aws-ovn-edge-zones
ci/prow/e2e-openstack-ovn 2d3fb70 link false /test e2e-openstack-ovn
ci/prow/e2e-metal-ipi-ovn 2d3fb70 link false /test e2e-metal-ipi-ovn
ci/prow/e2e-metal-ipi-ovn-ipv6 2d3fb70 link true /test e2e-metal-ipi-ovn-ipv6
ci/prow/e2e-aws-ovn-image-registry 2d3fb70 link true /test e2e-aws-ovn-image-registry
ci/prow/e2e-aws-ovn-cgroupsv2 2d3fb70 link false /test e2e-aws-ovn-cgroupsv2
ci/prow/e2e-gcp-ovn 2d3fb70 link true /test e2e-gcp-ovn
ci/prow/e2e-aws-ovn-single-node-serial 2d3fb70 link false /test e2e-aws-ovn-single-node-serial
ci/prow/e2e-aws-ovn-single-node 2d3fb70 link false /test e2e-aws-ovn-single-node
ci/prow/e2e-gcp-ovn-rt-upgrade 2d3fb70 link false /test e2e-gcp-ovn-rt-upgrade
ci/prow/e2e-aws-ovn-serial 2d3fb70 link true /test e2e-aws-ovn-serial
ci/prow/e2e-aws-ovn-single-node-upgrade 2d3fb70 link false /test e2e-aws-ovn-single-node-upgrade
ci/prow/e2e-gcp-ovn-upgrade 2d3fb70 link true /test e2e-gcp-ovn-upgrade
ci/prow/e2e-baremetalds-kubevirt 2d3fb70 link false /test e2e-baremetalds-kubevirt
ci/prow/e2e-aws-ovn-fips 2d3fb70 link true /test e2e-aws-ovn-fips
ci/prow/e2e-agnostic-ovn-cmd 2d3fb70 link false /test e2e-agnostic-ovn-cmd
ci/prow/e2e-aws-ovn-kubevirt 2d3fb70 link false /test e2e-aws-ovn-kubevirt

Full PR test history. Your PR dashboard.

Details

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-sigs/prow repository. I understand the commands that are listed here.

@openshift-trt-bot
Copy link

Job Failure Risk Analysis for sha: 2d3fb70

Job Name Failure Risk
pull-ci-openshift-origin-master-e2e-aws-ovn-single-node-upgrade IncompleteTests
Tests for this run (985) are below the historical average (2774): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)
pull-ci-openshift-origin-master-e2e-aws-ovn-ipsec-serial IncompleteTests
Tests for this run (27) are below the historical average (415): IncompleteTests (not enough tests ran to make a reasonable risk analysis; this could be due to infra, installation, or upgrade problems)

@soltysh soltysh closed this Aug 8, 2024
@soltysh soltysh deleted the refactor_client branch August 28, 2024 11:30
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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants