Skip to content

Commit 3e661a9

Browse files
zakiskchmouel
authored andcommitted
fix: Delete Gitea Cluster Task from E2E
deleted gitea cluster task e2e tests as clustertask is deprecated in OSP and its CRDs will be removed in upcoming release. Signed-off-by: Zaki Shaikh <zashaikh@redhat.com>
1 parent 9ea225c commit 3e661a9

File tree

4 files changed

+0
-121
lines changed

4 files changed

+0
-121
lines changed

test/gitea_test.go

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ import (
1414

1515
"code.gitea.io/sdk/gitea"
1616
"github.com/google/go-github/v70/github"
17-
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
1817
"github.com/tektoncd/pipeline/pkg/names"
19-
yaml "gopkg.in/yaml.v2"
2018
"gotest.tools/v3/assert"
2119
"gotest.tools/v3/env"
2220
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -30,7 +28,6 @@ import (
3028
tknpaclist "github.com/openshift-pipelines/pipelines-as-code/pkg/cmd/tknpac/list"
3129
tknpacresolve "github.com/openshift-pipelines/pipelines-as-code/pkg/cmd/tknpac/resolve"
3230
"github.com/openshift-pipelines/pipelines-as-code/pkg/git"
33-
"github.com/openshift-pipelines/pipelines-as-code/pkg/params"
3431
"github.com/openshift-pipelines/pipelines-as-code/pkg/params/info"
3532
"github.com/openshift-pipelines/pipelines-as-code/pkg/params/settings"
3633
"github.com/openshift-pipelines/pipelines-as-code/pkg/params/triggertype"
@@ -893,22 +890,6 @@ func TestGiteaErrorSnippetWithSecret(t *testing.T) {
893890
tgitea.WaitForPullRequestCommentMatch(t, topts)
894891
}
895892

896-
// TestGiteaNotExistingClusterTask checks that the pipeline run fails if the clustertask does not exist
897-
// This will test properly if we error the reason in UI see bug #1160.
898-
func TestGiteaNotExistingClusterTask(t *testing.T) {
899-
topts := &tgitea.TestOpts{
900-
Regexp: regexp.MustCompile(`.*clustertasks.tekton.dev "foo-bar" not found`),
901-
TargetEvent: triggertype.PullRequest.String(),
902-
YAMLFiles: map[string]string{
903-
".tekton/pr.yaml": "testdata/failures/not-existing-clustertask.yaml",
904-
},
905-
CheckForStatus: "failure",
906-
ExpectEvents: false,
907-
}
908-
_, f := tgitea.TestPR(t, topts)
909-
defer f()
910-
}
911-
912893
// TestGiteaBadLinkOfTask checks that we fail properly with the error from the
913894
// tekton pipelines controller. We check on the UI interface that we display
914895
// and inside the pac controller.
@@ -1153,65 +1134,6 @@ func TestGiteaPushToTagGreedy(t *testing.T) {
11531134
assert.NilError(t, err)
11541135
}
11551136

1156-
// TestGiteaClusterTasks is a test to verify that we can use cluster tasks with PaaC.
1157-
func TestGiteaClusterTasks(t *testing.T) {
1158-
// we need to verify sure to create clustertask before pushing the files
1159-
// so we have to create a new client and do more manual things we get for free in TestPR
1160-
topts := &tgitea.TestOpts{
1161-
TargetEvent: "pull_request, push",
1162-
YAMLFiles: map[string]string{
1163-
".tekton/prcluster.yaml": "testdata/pipelinerunclustertasks.yaml",
1164-
},
1165-
ExpectEvents: false,
1166-
}
1167-
topts.TargetRefName = names.SimpleNameGenerator.RestrictLengthWithRandomSuffix("pac-e2e-test")
1168-
topts.TargetNS = topts.TargetRefName
1169-
1170-
// create first the cluster tasks
1171-
ctname := fmt.Sprintf(".tekton/%s.yaml", topts.TargetNS)
1172-
newyamlFiles := map[string]string{ctname: "testdata/clustertask.yaml"}
1173-
entries, err := payload.GetEntries(newyamlFiles, topts.TargetNS, "main", "pull_request", map[string]string{})
1174-
assert.NilError(t, err)
1175-
//nolint: staticcheck
1176-
ct := v1beta1.ClusterTask{}
1177-
assert.NilError(t, yaml.Unmarshal([]byte(entries[ctname]), &ct))
1178-
ct.Name = "clustertask-" + topts.TargetNS
1179-
1180-
run := params.New()
1181-
ctx := context.Background()
1182-
assert.NilError(t, run.Clients.NewClients(ctx, &run.Info))
1183-
// TODO(chmou): this is for v1beta1, we need to figure out a way how to do that on v1
1184-
_, err = run.Clients.Tekton.TektonV1beta1().ClusterTasks().Create(context.TODO(), &ct, metav1.CreateOptions{})
1185-
assert.NilError(t, err)
1186-
assert.NilError(t, pacrepo.CreateNS(ctx, topts.TargetNS, run))
1187-
run.Clients.Log.Infof("%s has been created", ct.GetName())
1188-
defer (func() {
1189-
assert.NilError(t, topts.ParamsRun.Clients.Tekton.TektonV1beta1().ClusterTasks().Delete(context.TODO(), ct.Name, metav1.DeleteOptions{}))
1190-
run.Clients.Log.Infof("%s is deleted", ct.GetName())
1191-
})()
1192-
1193-
// start PR
1194-
_, f := tgitea.TestPR(t, topts)
1195-
defer f()
1196-
1197-
// wait for it
1198-
waitOpts := twait.Opts{
1199-
RepoName: topts.TargetNS,
1200-
Namespace: topts.TargetNS,
1201-
// 0 means 1 🙃 (we test for >, while we actually should do >=, but i
1202-
// need to go all over the code to verify it's not going to break
1203-
// anything else)
1204-
MinNumberStatus: 0,
1205-
PollTimeout: twait.DefaultTimeout,
1206-
TargetSHA: topts.PullRequest.Head.Sha,
1207-
}
1208-
_, err = twait.UntilRepositoryUpdated(context.Background(), topts.ParamsRun.Clients, waitOpts)
1209-
assert.NilError(t, err)
1210-
1211-
topts.CheckForStatus = "success"
1212-
tgitea.WaitForStatus(t, topts, topts.TargetRefName, "", true)
1213-
}
1214-
12151137
// Local Variables:
12161138
// compile-command: "go test -tags=e2e -v -run TestGiteaPush ."
12171139
// End:

test/testdata/clustertask.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

test/testdata/failures/not-existing-clustertask.yaml

Lines changed: 0 additions & 16 deletions
This file was deleted.

test/testdata/pipelinerunclustertasks.yaml

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)