-
Notifications
You must be signed in to change notification settings - Fork 630
Migrate upgrade tests to use new framework #4519
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
Changes from all commits
305b09f
0aa5b8c
a19da86
cd4788a
5acd72b
adfa4ec
99c453f
cd5a8bb
23e9ad8
ad2fd71
2ab0f25
2b9d041
2741bbd
01dc790
0dd2c3f
84d6ac4
21b6248
2c74fa7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| Copyright 2020 The Knative Authors | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package upgrade | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| testlib "knative.dev/eventing/test/lib" | ||
| "knative.dev/eventing/test/upgrade/prober" | ||
| pkgupgrade "knative.dev/pkg/test/upgrade" | ||
| ) | ||
|
|
||
| func ContinualTest() pkgupgrade.BackgroundOperation { | ||
| ctx := context.Background() | ||
| var client *testlib.Client | ||
| var probe prober.Prober | ||
| return pkgupgrade.NewBackgroundVerification("EventingContinualTest", | ||
| func(c pkgupgrade.Context) { | ||
| // setup | ||
| client = testlib.Setup(c.T, false) | ||
| config := prober.NewConfig(client.Namespace) | ||
| probe = prober.RunEventProber(ctx, c.Log, client, config) | ||
| }, | ||
| func(c pkgupgrade.Context) { | ||
| // verify | ||
| defer testlib.TearDown(client) | ||
| prober.AssertEventProber(ctx, c.T, probe) | ||
| }, | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| Copyright 2020 The Knative Authors | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package installation | ||
|
|
||
| import ( | ||
| pkgupgrade "knative.dev/pkg/test/upgrade" | ||
| ) | ||
|
|
||
| func GitHead() pkgupgrade.Operation { | ||
| return pkgupgrade.NewOperation("EventingGitHead", func(c pkgupgrade.Context) { | ||
| ops := []string{ | ||
| "install_head", | ||
| "install_channel_crds", | ||
| "install_mt_broker", | ||
| "install_sugar", | ||
| } | ||
|
Comment on lines
+25
to
+30
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am a little bit concerned about this as sometimes there may be hacky code in bash script to install it properly, eg waiting to make sure all the pods in the previous step are running before applying next. I am wondering if there is a bash function that does all these installations and we can just call the bash function instead. But for sure we can change it later if such a bash function is required.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are no such function. Each of those functions has appropriate waits built inside, so it isn't needed. Current code executes them directly: https://github.com/knative/eventing/pull/4519/files#diff-1c4d417537c9878a5068005f79761334318400204068c4dfd4a7656226bfefe1L61-L64 |
||
| for _, shellfunc := range ops { | ||
| c.Log.Info("Running shell function: ", shellfunc) | ||
| err := callShellFunction(shellfunc) | ||
| if err != nil { | ||
| c.T.Error(err) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will break operations, yeah. |
||
| return | ||
| } | ||
| } | ||
| }) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| Copyright 2020 The Knative Authors | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package installation | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we can just use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used That's why I think |
||
|
|
||
| import ( | ||
| pkgupgrade "knative.dev/pkg/test/upgrade" | ||
| ) | ||
|
|
||
| func LatestStable() pkgupgrade.Operation { | ||
| return pkgupgrade.NewOperation("EventingLatestRelease", func(c pkgupgrade.Context) { | ||
| shellfunc := "install_latest_release" | ||
| c.Log.Info("Running shell function: ", shellfunc) | ||
| err := callShellFunction(shellfunc) | ||
| if err != nil { | ||
| c.T.Error(err) | ||
| return | ||
| } | ||
| }) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* | ||
| Copyright 2020 The Knative Authors | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package installation | ||
|
|
||
| import ( | ||
| "knative.dev/hack/shell" | ||
| ) | ||
|
|
||
| func callShellFunction(funcName string) error { | ||
| loc, err := shell.NewProjectLocation("../../..") | ||
| if err != nil { | ||
| return err | ||
| } | ||
| exec := shell.NewExecutor(shell.ExecutorConfig{ | ||
| ProjectLocation: loc, | ||
| }) | ||
| fn := shell.Function{ | ||
| Script: shell.Script{ | ||
| Label: funcName, | ||
| ScriptPath: "test/e2e-common.sh", | ||
| }, | ||
| FunctionName: funcName, | ||
| } | ||
| return exec.RunFunction(fn) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| Copyright 2020 The Knative Authors | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package upgrade | ||
|
|
||
| import ( | ||
| pkgupgrade "knative.dev/pkg/test/upgrade" | ||
| ) | ||
|
|
||
| func PostDowngradeTest() pkgupgrade.Operation { | ||
| return pkgupgrade.NewOperation("EventingPostDowngradeTest", func(c pkgupgrade.Context) { | ||
| runSmokeTest(c.T) | ||
| }) | ||
| } |
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.
what was the issue here @cardil ? just curious
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.
When using strict bash setting of
set -Eeuo pipefailthat fails because of-u: fail on unset variable being dereferenced.Bash could know if variable is unset or empty.