cleanup: run test operations in dedicated ns (#1791)

Signed-off-by: Matej Vasek <mvasek@redhat.com>
This commit is contained in:
Matej Vasek 2023-06-07 09:21:57 +02:00 committed by GitHub
parent 2af040f5b7
commit 4386689f41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 7 deletions

View File

@ -107,6 +107,7 @@ func TestGitlab(t *testing.T) {
} }
pp := tekton.NewPipelinesProvider( pp := tekton.NewPipelinesProvider(
tekton.WithCredentialsProvider(credentialsProvider), tekton.WithCredentialsProvider(credentialsProvider),
tekton.WithNamespace(ns),
tekton.WithPacURLCallback(func() (string, error) { tekton.WithPacURLCallback(func() (string, error) {
return "http://" + pacCtrHostname, nil return "http://" + pacCtrHostname, nil
})) }))
@ -125,7 +126,7 @@ func TestGitlab(t *testing.T) {
_ = pp.RemovePAC(context.Background(), f, metadata) _ = pp.RemovePAC(context.Background(), f, metadata)
}) })
buildDoneCh := awaitBuildCompletion(t, glabEnv.ProjectName) buildDoneCh := awaitBuildCompletion(t, glabEnv.ProjectName, ns)
gitCommands := `export GIT_TERMINAL_PROMPT=0 && \ gitCommands := `export GIT_TERMINAL_PROMPT=0 && \
cd "${PROJECT_DIR}" && \ cd "${PROJECT_DIR}" && \
@ -552,11 +553,7 @@ func usingNamespace(t *testing.T) string {
return name return name
} }
func awaitBuildCompletion(t *testing.T, name string) <-chan struct{} { func awaitBuildCompletion(t *testing.T, name, ns string) <-chan struct{} {
defaultNS, err := k8s.GetNamespace("")
if err != nil {
t.Fatal(err)
}
clis, err := tekton.NewTektonClients() clis, err := tekton.NewTektonClients()
if err != nil { if err != nil {
@ -567,7 +564,7 @@ func awaitBuildCompletion(t *testing.T, name string) <-chan struct{} {
LabelSelector: "tekton.dev/pipelineTask=build", LabelSelector: "tekton.dev/pipelineTask=build",
Watch: true, Watch: true,
} }
w, err := clis.Tekton.TektonV1().TaskRuns(defaultNS).Watch(context.Background(), listOpts) w, err := clis.Tekton.TektonV1().TaskRuns(ns).Watch(context.Background(), listOpts)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }