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

Update bundle tests to use IP of service to avoid cluster domain rules #3431

Merged
merged 1 commit into from
Oct 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions test/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,13 @@ func getRegistryService(namespace string) *corev1.Service {
},
}
}

// getRegistryServiceIP fetches the registry service's current IP.
func getRegistryServiceIP(ctx context.Context, t *testing.T, c *clients, namespace string) string {
t.Helper()
svc, err := c.KubeClient.Kube.CoreV1().Services(namespace).Get(ctx, "registry", metav1.GetOptions{})
if err != nil {
t.Fatalf("failed to lookup registry service: %q", err)
}
return svc.Spec.ClusterIP
}
6 changes: 3 additions & 3 deletions test/tektonbundles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func TestTektonBundlesSimpleWorkingExample(t *testing.T) {
taskName := "hello-world"
pipelineName := "hello-world-pipeline"
pipelineRunName := "hello-world-piplinerun"
repo := fmt.Sprintf("registry.%s.svc.cluster.local:5000/tektonbundlessimple", namespace)
repo := fmt.Sprintf("%s:5000/tektonbundlessimple", getRegistryServiceIP(ctx, t, c, namespace))

ref, err := name.ParseReference(repo)
if err != nil {
Expand Down Expand Up @@ -333,7 +333,7 @@ func TestTektonBundlesUsingRegularImage(t *testing.T) {
taskName := "hello-world-dne"
pipelineName := "hello-world-pipeline-dne"
pipelineRunName := "hello-world-piplinerun"
repo := fmt.Sprintf("registry.%s.svc.cluster.local:5000/tektonbundlesregularimage", namespace)
repo := fmt.Sprintf("%s:5000/tektonbundlesregularimage", getRegistryServiceIP(ctx, t, c, namespace))

ref, err := name.ParseReference(repo)
if err != nil {
Expand Down Expand Up @@ -418,7 +418,7 @@ func TestTektonBundlesUsingImproperFormat(t *testing.T) {
taskName := "hello-world"
pipelineName := "hello-world-pipeline"
pipelineRunName := "hello-world-piplinerun"
repo := fmt.Sprintf("registry.%s.svc.cluster.local:5000/tektonbundlesimproperformat", namespace)
repo := fmt.Sprintf("%s:5000/tektonbundlesimproperformat", getRegistryServiceIP(ctx, t, c, namespace))

ref, err := name.ParseReference(repo)
if err != nil {
Expand Down