-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add multiarch specific fixes to the pipeline tests
Test code has many amd64 specific images. Tests fail on non amd64 architecture because of that. This code provides one place to keep multiarch specific updates, separated for each architecture. Multiarch utils do following: - replace image names to arch specific ones whete it is applicable - skip the tests, which fail for non amd64 arch now, based on test name and architecture - skipping will be applied for e2e and examples tests Signed-off-by: Yulia Gaponenko <[email protected]>
- Loading branch information
Showing
9 changed files
with
270 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
/* | ||
Copyright 2019 The Tekton 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 test | ||
|
||
import "runtime" | ||
|
||
var ( | ||
imageNames = initImageNames() | ||
excludedTests = initExcludedTests() | ||
) | ||
|
||
const ( | ||
// Busybox image with specific sha | ||
BusyboxSha = iota | ||
// Registry image | ||
Registry | ||
) | ||
|
||
func initImageNames() map[int]string { | ||
mapping := make(map[int]string) | ||
|
||
switch arch := runtime.GOARCH; arch { | ||
case "s390x": | ||
mapping[BusyboxSha] = "busybox@sha256:4f47c01fa91355af2865ac10fef5bf6ec9c7f42ad2321377c21e844427972977" | ||
mapping[Registry] = "ibmcom/registry:2.6.2.5" | ||
|
||
default: | ||
mapping[BusyboxSha] = "busybox@sha256:895ab622e92e18d6b461d671081757af7dbaa3b00e3e28e12505af7817f73649" | ||
mapping[Registry] = "registry" | ||
} | ||
return mapping | ||
} | ||
|
||
func initExcludedTests() map[string]bool { | ||
mapping := make(map[string]bool) | ||
tests := []string{} | ||
switch arch := runtime.GOARCH; arch { | ||
case "s390x": | ||
//examples | ||
tests = []string{ | ||
"v1alpha1/taskruns/dind-sidecar", | ||
"v1beta1/taskruns/dind-sidecar", | ||
"v1alpha1/taskruns/build-gcs-targz", | ||
"v1beta1/taskruns/build-gcs-targz", | ||
"v1alpha1/taskruns/build-push-kaniko", | ||
"v1alpha1/taskruns/pull-private-image", | ||
"v1beta1/taskruns/pull-private-image", | ||
"v1alpha1/pipelineruns/pipelinerun", | ||
"v1beta1/pipelineruns/pipelinerun", | ||
"v1beta1/taskruns/build-gcs-zip", | ||
"v1alpha1/taskruns/build-gcs-zip", | ||
"v1alpha1/taskruns/git-volume", | ||
"v1beta1/taskruns/git-volume", | ||
"v1beta1/taskruns/docker-creds", | ||
"v1alpha1/taskruns/docker-creds", | ||
"v1beta1/taskruns/steps-run-in-order", | ||
"v1alpha1/taskruns/steps-run-in-order", | ||
"v1beta1/taskruns/step-by-digest", | ||
"v1alpha1/taskruns/step-by-digest", | ||
"v1alpha1/taskruns/gcs-resource", | ||
"v1beta1/taskruns/gcs-resource", | ||
"v1beta1/taskruns/authenticating-git-commands", | ||
"v1beta1/pipelineruns/pipelinerun-with-final-tasks", | ||
"v1beta1/taskruns/pullrequest_input_copystep_output", | ||
"v1alpha1/taskruns/pullrequest_input_copystep_output", | ||
"v1beta1/taskruns/pullrequest", | ||
"v1alpha1/taskruns/pullrequest", | ||
"v1beta1/taskruns/step-script", | ||
"v1alpha1/taskruns/step-script", | ||
"v1beta1/pipelineruns/conditional-pipelinerun", | ||
"v1alpha1/pipelineruns/pipelinerun-with-resourcespec", | ||
"v1beta1/pipelineruns/pipelinerun-with-resourcespec", | ||
"v1beta1/taskruns/git-ssh-creds-without-known_hosts", | ||
"v1alpha1/taskruns/optional-resources", | ||
"v1beta1/taskruns/optional-resources", | ||
"v1beta1/taskruns/task-output-image", | ||
//e2e | ||
"TestEntrypointRunningStepsInOrder", | ||
"TestWorkingDirIgnoredNonSlashWorkspace", | ||
"TestTaskRun_EmbeddedResource", | ||
"TestTaskRunPipelineRunCancel", | ||
"TestEntrypointRunningStepsInOrder", | ||
"TestGitPipelineRun", | ||
"TestGitPipelineRunFail", | ||
"TestGitPipelineRunWithRefspec", | ||
"TestGitPipelineRun_Disable_SSLVerify", | ||
"TestGitPipelineRunWithNonMasterBranch", | ||
"TestHelmDeployPipelineRun", | ||
"TestKanikoTaskRun", | ||
"TestPipelineRun", | ||
"TestSidecarTaskSupport", | ||
"TestWorstkingDirCreated", | ||
"TestWorkingDirIgnoredNonSlashWorkspace", | ||
"TestWorkingDirCreated", | ||
"service account propagation and pipeline param", | ||
"pipelinerun succeeds with LimitRange minimum in namespace", | ||
} | ||
default: | ||
// do nothing | ||
} | ||
|
||
for _, test := range tests { | ||
mapping[test] = true | ||
} | ||
|
||
return mapping | ||
} | ||
|
||
// get test image based on unique id | ||
func GetTestImage(image int) string { | ||
return imageNames[image] | ||
} | ||
|
||
// check if test name is in the excluded list based on current hardware architecture | ||
func IsExcluded(testName string) bool { | ||
return excludedTests[testName] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// +build !e2e | ||
|
||
/* | ||
Copyright 2019 The Tekton 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 test | ||
|
||
import ( | ||
"runtime" | ||
"testing" | ||
) | ||
|
||
var excludedtests = map[string][]struct { | ||
in string | ||
out bool | ||
}{ | ||
"s390x": { | ||
{ | ||
"v1beta1/taskruns/optional-resources", | ||
true, | ||
}, | ||
{ | ||
"TestEntrypointRunningStepsInOrder", | ||
true, | ||
}, | ||
{ | ||
"TestEntrypointRunningStepsInOrderNotExcluded", | ||
false, | ||
}, | ||
}, | ||
"amd64": { | ||
|
||
{ | ||
"v1beta1/taskruns/optional-resources", | ||
false, | ||
}, | ||
{ | ||
"TestEntrypointRunningStepsInOrder", | ||
false, | ||
}, | ||
{ | ||
"TestEntrypointRunningStepsInOrderNotExcluded", | ||
false, | ||
}, | ||
}, | ||
} | ||
|
||
func TestGetTestImage(t *testing.T) { | ||
var imageName string | ||
|
||
image := GetTestImage(BusyboxSha) | ||
arch := runtime.GOARCH | ||
|
||
switch arch { | ||
case "s390x": | ||
imageName = "busybox@sha256:4f47c01fa91355af2865ac10fef5bf6ec9c7f42ad2321377c21e844427972977" | ||
default: | ||
imageName = "busybox@sha256:895ab622e92e18d6b461d671081757af7dbaa3b00e3e28e12505af7817f73649" | ||
} | ||
|
||
if image != imageName { | ||
t.Errorf("get image failed for %s arch, got %s instead of %s", arch, image, imageName) | ||
} | ||
} | ||
|
||
func TestIsExcluded(t *testing.T) { | ||
arch := runtime.GOARCH | ||
if arch != "s390x" && arch != "amd64" { | ||
t.Skip("not supported architecture") | ||
} | ||
|
||
for _, tt := range excludedtests[arch] { | ||
t.Run(tt.in, func(t *testing.T) { | ||
tt := tt | ||
s := IsExcluded(tt.in) | ||
if s != tt.out { | ||
t.Errorf("got %t result, want %t result", s, tt.out) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters