-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Refactor e2e framework to remove globals #2037
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
Conversation
/test e2e-aws-go |
/test e2e-aws-go |
@camilamacedo86 Looks like a legitimate CI failure, so I think I need to make more changes to get this to pass. |
HI @joelanford,
Unfortunately, yes. I checked the logs now. Since it usually stucks I try 2 times see if pass if not then I check the logs. |
@@ -70,26 +66,26 @@ func (ctx *TestCtx) createFromYAML(yamlFile []byte, skipIfExists bool, cleanupOp | |||
return fmt.Errorf("failed to unmarshal object spec: (%v)", err) | |||
} | |||
obj.SetNamespace(namespace) | |||
err = Global.Client.Create(goctx.TODO(), obj, cleanupOptions) | |||
err = ctx.client.Create(goctx.TODO(), obj, cleanupOptions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code shows great and is passing in the test which should enough to ensure it.
Just a nit, it shows be a break changing. Is not it missing the changelog? Also, should not it goes to a migrate doc? Could we work with an unreleased section as well? WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a breaking change. Did I break something without realizing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to change the doc since it says for the users use the global one and will it framework.Global
will still be working? If not, then I think is a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. framework.Global
is still there and configured the same way. I think there is no change to any public API or functionality at all. Just an internal refactoring to get rid of the unexported global variables.
fa5fbda
to
1bf37be
Compare
…st failure reason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it just affects the internal tests then the CI should be enough to ensure the qa.
It is just removing the global vars and adding as an attributes of the struct.
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
@@ -29,7 +29,7 @@ func ExecCmd(cmd *exec.Cmd) error { | |||
cmd.Stderr = os.Stderr | |||
log.Debugf("Running %#v", cmd.Args) | |||
if err := cmd.Run(); err != nil { | |||
return fmt.Errorf("failed to exec %#v: %v", cmd.Args, err) | |||
return fmt.Errorf("failed to exec %#v: %w", cmd.Args, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This patch resolves mergeconflicts in cherry-pick ea8caeb and recent refactoring in operator-sdk/pkg/test operator-framework#2037 Add --watch-namespace flag to `operator-sdk test local <test-dir> --up-local` command `--deploy-namespace` flag specifies namespace where namespaced resources are deployed for testing `--watch-namespace` flag specifies the namespace which operator watches during testing. That is the value of `WATCH_NAMESPACE` envvar **the behavior of `--watch-namespace` flags is as follows** when not set `WATCH_NAMESPACE` is set to deploy namespace. which means when `--watch-namespace` is not set, watch-namespace == deploy-namespace operator watched deploy-namespace during testing `--watch-namespace=foo` `WATCH_NAMESPACES=foo` operator watches namespace `foo` during testing `--watch-namespace=""` `WATCH_NAMESPACES=""` operator watches all namespaces during testing Update tests Signed-off-by: Nikhil Thomas <[email protected]> (cherry picked from commit ea8caeb) Signed-off-by: Nikhil Thomas <[email protected]>
This patch resolves mergeconflicts in cherry-pick ea8caeb and recent refactoring in operator-sdk/pkg/test operator-framework#2037 Add --watch-namespace flag to `operator-sdk test local <test-dir> --up-local` command `--deploy-namespace` flag specifies namespace where namespaced resources are deployed for testing `--watch-namespace` flag specifies the namespace which operator watches during testing. That is the value of `WATCH_NAMESPACE` envvar **the behavior of `--watch-namespace` flags is as follows** when not set `WATCH_NAMESPACE` is set to deploy namespace. which means when `--watch-namespace` is not set, watch-namespace == deploy-namespace operator watched deploy-namespace during testing `--watch-namespace=foo` `WATCH_NAMESPACES=foo` operator watches namespace `foo` during testing `--watch-namespace=""` `WATCH_NAMESPACES=""` operator watches all namespaces during testing Update tests Signed-off-by: Nikhil Thomas <[email protected]> (cherry picked from commit ea8caeb) Signed-off-by: Nikhil Thomas <[email protected]>
This patch resolves mergeconflicts in cherry-pick ea8caeb and recent refactoring in operator-sdk/pkg/test operator-framework#2037 Add --watch-namespace flag to `operator-sdk test local <test-dir> --up-local` command `--deploy-namespace` flag specifies namespace where namespaced resources are deployed for testing `--watch-namespace` flag specifies the namespace which operator watches during testing. That is the value of `WATCH_NAMESPACE` envvar **the behavior of `--watch-namespace` flags is as follows** when not set `WATCH_NAMESPACE` is set to deploy namespace. which means when `--watch-namespace` is not set, watch-namespace == deploy-namespace operator watched deploy-namespace during testing `--watch-namespace=foo` `WATCH_NAMESPACES=foo` operator watches namespace `foo` during testing `--watch-namespace=""` `WATCH_NAMESPACES=""` operator watches all namespaces during testing Update tests Signed-off-by: Nikhil Thomas <[email protected]> (cherry picked from commit ea8caeb) Signed-off-by: Nikhil Thomas <[email protected]>
This patch resolves mergeconflicts in cherry-pick ea8caeb and recent refactoring in operator-sdk/pkg/test operator-framework#2037 Add --watch-namespace flag to `operator-sdk test local <test-dir> --up-local` command `--deploy-namespace` flag specifies namespace where namespaced resources are deployed for testing `--watch-namespace` flag specifies the namespace which operator watches during testing. That is the value of `WATCH_NAMESPACE` envvar **the behavior of `--watch-namespace` flags is as follows** when not set `WATCH_NAMESPACE` is set to deploy namespace. which means when `--watch-namespace` is not set, watch-namespace == deploy-namespace operator watched deploy-namespace during testing `--watch-namespace=foo` `WATCH_NAMESPACES=foo` operator watches namespace `foo` during testing `--watch-namespace=""` `WATCH_NAMESPACES=""` operator watches all namespaces during testing Update tests Signed-off-by: Nikhil Thomas <[email protected]> (cherry picked from commit ea8caeb) Signed-off-by: Nikhil Thomas <[email protected]>
This patch resolves mergeconflicts in cherry-pick ea8caeb and recent refactoring in operator-sdk/pkg/test operator-framework#2037 Add --watch-namespace flag to `operator-sdk test local <test-dir> --up-local` command `--deploy-namespace` flag specifies namespace where namespaced resources are deployed for testing `--watch-namespace` flag specifies the namespace which operator watches during testing. That is the value of `WATCH_NAMESPACE` envvar **the behavior of `--watch-namespace` flags is as follows** when not set `WATCH_NAMESPACE` is set to deploy namespace. which means when `--watch-namespace` is not set, watch-namespace == deploy-namespace operator watched deploy-namespace during testing `--watch-namespace=foo` `WATCH_NAMESPACES=foo` operator watches namespace `foo` during testing `--watch-namespace=""` `WATCH_NAMESPACES=""` operator watches all namespaces during testing Update tests Signed-off-by: Nikhil Thomas <[email protected]> (cherry picked from commit ea8caeb) Signed-off-by: Nikhil Thomas <[email protected]>
This patch resolves mergeconflicts in cherry-pick ea8caeb and recent refactoring in operator-sdk/pkg/test operator-framework#2037 Add --watch-namespace flag to `operator-sdk test local <test-dir> --up-local` command `--deploy-namespace` flag specifies namespace where namespaced resources are deployed for testing `--watch-namespace` flag specifies the namespace which operator watches during testing. That is the value of `WATCH_NAMESPACE` envvar **the behavior of `--watch-namespace` flags is as follows** when not set `WATCH_NAMESPACE` is set to deploy namespace. which means when `--watch-namespace` is not set, watch-namespace == deploy-namespace operator watched deploy-namespace during testing `--watch-namespace=foo` `WATCH_NAMESPACES=foo` operator watches namespace `foo` during testing `--watch-namespace=""` `WATCH_NAMESPACES=""` operator watches all namespaces during testing Update tests Signed-off-by: Nikhil Thomas <[email protected]> (cherry picked from commit ea8caeb) Signed-off-by: Nikhil Thomas <[email protected]>
Description of the change:
This PR refactors the e2e framework to remove unnecessary global variables.
Motivation for the change:
Global Variables Are Bad