Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cfac235

Browse files
zakisksavitaashture
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 <[email protected]>
1 parent e9febd3 commit cfac235

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/v68/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"
@@ -869,22 +866,6 @@ func TestGiteaErrorSnippetWithSecret(t *testing.T) {
869866
tgitea.WaitForPullRequestCommentMatch(t, topts)
870867
}
871868

872-
// TestGiteaNotExistingClusterTask checks that the pipeline run fails if the clustertask does not exist
873-
// This will test properly if we error the reason in UI see bug #1160.
874-
func TestGiteaNotExistingClusterTask(t *testing.T) {
875-
topts := &tgitea.TestOpts{
876-
Regexp: regexp.MustCompile(`.*clustertasks.tekton.dev "foo-bar" not found`),
877-
TargetEvent: triggertype.PullRequest.String(),
878-
YAMLFiles: map[string]string{
879-
".tekton/pr.yaml": "testdata/failures/not-existing-clustertask.yaml",
880-
},
881-
CheckForStatus: "failure",
882-
ExpectEvents: false,
883-
}
884-
_, f := tgitea.TestPR(t, topts)
885-
defer f()
886-
}
887-
888869
// TestGiteaBadLinkOfTask checks that we fail properly with the error from the
889870
// tekton pipelines controller. We check on the UI interface that we display
890871
// and inside the pac controller.
@@ -1128,65 +1109,6 @@ func TestGiteaPushToTagGreedy(t *testing.T) {
11281109
assert.NilError(t, err)
11291110
}
11301111

1131-
// TestGiteaClusterTasks is a test to verify that we can use cluster tasks with PaaC.
1132-
func TestGiteaClusterTasks(t *testing.T) {
1133-
// we need to verify sure to create clustertask before pushing the files
1134-
// so we have to create a new client and do more manual things we get for free in TestPR
1135-
topts := &tgitea.TestOpts{
1136-
TargetEvent: "pull_request, push",
1137-
YAMLFiles: map[string]string{
1138-
".tekton/prcluster.yaml": "testdata/pipelinerunclustertasks.yaml",
1139-
},
1140-
ExpectEvents: false,
1141-
}
1142-
topts.TargetRefName = names.SimpleNameGenerator.RestrictLengthWithRandomSuffix("pac-e2e-test")
1143-
topts.TargetNS = topts.TargetRefName
1144-
1145-
// create first the cluster tasks
1146-
ctname := fmt.Sprintf(".tekton/%s.yaml", topts.TargetNS)
1147-
newyamlFiles := map[string]string{ctname: "testdata/clustertask.yaml"}
1148-
entries, err := payload.GetEntries(newyamlFiles, topts.TargetNS, "main", "pull_request", map[string]string{})
1149-
assert.NilError(t, err)
1150-
//nolint: staticcheck
1151-
ct := v1beta1.ClusterTask{}
1152-
assert.NilError(t, yaml.Unmarshal([]byte(entries[ctname]), &ct))
1153-
ct.Name = "clustertask-" + topts.TargetNS
1154-
1155-
run := params.New()
1156-
ctx := context.Background()
1157-
assert.NilError(t, run.Clients.NewClients(ctx, &run.Info))
1158-
// TODO(chmou): this is for v1beta1, we need to figure out a way how to do that on v1
1159-
_, err = run.Clients.Tekton.TektonV1beta1().ClusterTasks().Create(context.TODO(), &ct, metav1.CreateOptions{})
1160-
assert.NilError(t, err)
1161-
assert.NilError(t, pacrepo.CreateNS(ctx, topts.TargetNS, run))
1162-
run.Clients.Log.Infof("%s has been created", ct.GetName())
1163-
defer (func() {
1164-
assert.NilError(t, topts.ParamsRun.Clients.Tekton.TektonV1beta1().ClusterTasks().Delete(context.TODO(), ct.Name, metav1.DeleteOptions{}))
1165-
run.Clients.Log.Infof("%s is deleted", ct.GetName())
1166-
})()
1167-
1168-
// start PR
1169-
_, f := tgitea.TestPR(t, topts)
1170-
defer f()
1171-
1172-
// wait for it
1173-
waitOpts := twait.Opts{
1174-
RepoName: topts.TargetNS,
1175-
Namespace: topts.TargetNS,
1176-
// 0 means 1 πŸ™ƒ (we test for >, while we actually should do >=, but i
1177-
// need to go all over the code to verify it's not going to break
1178-
// anything else)
1179-
MinNumberStatus: 0,
1180-
PollTimeout: twait.DefaultTimeout,
1181-
TargetSHA: topts.PullRequest.Head.Sha,
1182-
}
1183-
_, err = twait.UntilRepositoryUpdated(context.Background(), topts.ParamsRun.Clients, waitOpts)
1184-
assert.NilError(t, err)
1185-
1186-
topts.CheckForStatus = "success"
1187-
tgitea.WaitForStatus(t, topts, topts.TargetRefName, "", true)
1188-
}
1189-
11901112
// Local Variables:
11911113
// compile-command: "go test -tags=e2e -v -run TestGiteaPush ."
11921114
// 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)