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

Syncing latest changes from upstream main for ramen #476

Merged
merged 17 commits into from
Mar 17, 2025
Merged

Conversation

df-build-team
Copy link

PR containing the latest commits from upstream main branch

nirs added 17 commits March 16, 2025 13:37
Replace the invalid requirement with latest version to make ramen/e2e
usable by external projects like ramenctl.

We will have to manually upgrade ramen/api version when we need to
consume a change in the api, same way we use external projects.

Created using:

    % go get github.com/ramendr/ramen/api@latest
    go: upgraded github.com/ramendr/ramen/api v0.0.0-00010101000000-000000000000 => v0.0.0-20250313143647-8dd671566929

    % go mod tidy

Fixes: RamenDR#1926
Signed-off-by: Nir Soffer <[email protected]>
There is no reason to make the command line options package globals
since they are consumed only in TestMain().

Signed-off-by: Nir Soffer <[email protected]>
We used to keep the main logger in utils.Ctx.Log and access it from all
code that does not run in test context. This does not work for ramenctl
which want to create the logger and pass it to commands as parameter.

Since we need to keep global test variables, add a Context type to
e2e_test package. This will be the only global variable to make managed
of global variables easier and explicit.

Move the logger from util.Ctx.Log to Ctx.log. This makes the logger
accessible only the tests in the e2e_test package. The tests pass this
log around to other code, or add it to the per-test context.

Signed-off-by: Nir Soffer <[email protected]>
- Import "k8s.io/apimachinery/pkg/api/errors" as k8serrors
- Import "k8s.io/apimachinery/pkg/types" as k8types

This make room for "github.com/ramendr/ramen/e2e/types" and standard
library "errors" package.

Signed-off-by: Nir Soffer <[email protected]>
We want to keep the config in the context, and for this we need to
provide and interface returning a cluster. So the cluster must be part
of the types package.

This also remove bad dependency on the util package, preventing import
of the types package in the util package.

Signed-off-by: Nir Soffer <[email protected]>
Consistent import order:
- standard library
- 3rp party imports
- e2e imports

Signed-off-by: Nir Soffer <[email protected]>
The environment is important concept so it should have it own package.
The new Env type replaces util.Context. We create the instance in
main_test.go, and pass it to the tests via package global. The dr test
add the env to the test context, and most of the code access the
clusters via the ctx.Env().

Signed-off-by: Nir Soffer <[email protected]>
We want to access the config from types.Context. To do this without
introducing complex dependencies, the types should be part of the types
package.

Signed-off-by: Nir Soffer <[email protected]>
All validation is done now in a validate* function returning an error.
This simplifies the function, removing the linter skip, makes the code
easier to follow, and make it easier to extend validation for parts we
don't validate properly (PVCSpecs).

Signed-off-by: Nir Soffer <[email protected]>
Functions are easier to follow when using the same abstraction level.
Move out the code reading the config to a helper to make ReadConfig()
very simple and clear.

Signed-off-by: Nir Soffer <[email protected]>
When we added config.Namespaces it was never used. Change validateDistro
to also initialize the Namespaces field.

Signed-off-by: Nir Soffer <[email protected]>
Previously we kept the single config in the config package, and access
it using functions. Now we create a config object and pass it to the
tests via the global context. The test pass the config to code operating
on the global context (e.g. create a channel), and pass the config to
the test context. The rest of the code access the config using the test
context, in same way we access the env and log.

This eliminate the dependency on the config package. It is used now only
in main_test.go and in dr_test.go for getting PVCSpecs mapping.

In ramenctl will use this to create a config object and pass it to the
command as parameter.

Signed-off-by: Nir Soffer <[email protected]>
We don't need to use "Clusters" since viper supports lowercase
"clusters".

Signed-off-by: Nir Soffer <[email protected]>
- Mention "clusters" once to make this easier to change without breaking
  the code. In the last change I forgot to modify the name in both
  places. New code makes this mistake impossible.

- Use "kubeconfig" instead of "path", this is more specific and make the
  code more clear.

Signed-off-by: Nir Soffer <[email protected]>
Replace misspelled "standlone" with "self-contained" matching kubectl
config view help.

Signed-off-by: Nir Soffer <[email protected]>
Use the common term when referring to kubeconfig file to make it easier
to use and nicer. This is also the documented config format in ramenctl.

Also shorten the sample configuration to avoid repeating the term
"kubeconfig" and match the default kubeconfig (~/.kube/config).

Signed-off-by: Nir Soffer <[email protected]>
Copy link

openshift-ci bot commented Mar 17, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: df-build-team

The full list of commands accepted by this bot can be found 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

@ShyamsundarR ShyamsundarR merged commit 0259e7e into main Mar 17, 2025
48 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants