Skip to content

Commit 58c9cde

Browse files
chmouelzakisk
authored andcommitted
fix: Increase log line count for tests
Increased the maximum number of log lines to check in various test cases. This change was made to accommodate potentially longer log outputs during test execution, preventing false negatives due to insufficient log history being examined. Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
1 parent 644c495 commit 58c9cde

9 files changed

+16
-16
lines changed

test/gitea_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func TestGiteaPullRequestPrivateRepository(t *testing.T) {
161161
ctx, f := tgitea.TestPR(t, topts)
162162
defer f()
163163
reg := regexp.MustCompile(".*successfully fetched git-clone task from default configured catalog Hub")
164-
maxLines := int64(100)
164+
maxLines := int64(1000)
165165
err := twait.RegexpMatchingInControllerLog(ctx, topts.ParamsRun, *reg, 20, "controller", &maxLines)
166166
assert.NilError(t, err)
167167
tgitea.WaitForSecretDeletion(t, topts, topts.TargetRefName)
@@ -252,7 +252,7 @@ func TestGiteaBadYamlValidation(t *testing.T) {
252252

253253
ctx, f := tgitea.TestPR(t, topts)
254254
defer f()
255-
maxLines := int64(20)
255+
maxLines := int64(1000)
256256
assert.NilError(t, twait.RegexpMatchingInControllerLog(ctx, topts.ParamsRun, *regexp.MustCompile(
257257
"cannot read the PipelineRun: pr-bad-format.yaml, error: yaml validation error: line 3: could not find expected ':'"),
258258
10, "controller", &maxLines))
@@ -998,7 +998,7 @@ func TestGiteaBadLinkOfTask(t *testing.T) {
998998
ctx, f := tgitea.TestPR(t, topts)
999999
defer f()
10001000
errre := regexp.MustCompile("There was an error starting the PipelineRun")
1001-
maxLines := int64(20)
1001+
maxLines := int64(1000)
10021002
assert.NilError(t, twait.RegexpMatchingInControllerLog(ctx, topts.ParamsRun, *errre, 10, "controller", &maxLines))
10031003
}
10041004

@@ -1019,7 +1019,7 @@ func TestGiteaPipelineRunWithSameName(t *testing.T) {
10191019
ctx, f := tgitea.TestPR(t, topts)
10201020
defer f()
10211021
errre := regexp.MustCompile("found multiple pipelinerun in .tekton with the same name")
1022-
maxLines := int64(20)
1022+
maxLines := int64(1000)
10231023
assert.NilError(t, twait.RegexpMatchingInControllerLog(ctx, topts.ParamsRun, *errre, 10, "controller", &maxLines))
10241024
}
10251025

test/github_pullrequest_privaterepository_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestGithubPullRequestGitClone(t *testing.T) {
2828
ctx, err := cctx.GetControllerCtxInfo(ctx, g.Cnx)
2929
assert.NilError(t, err)
3030

31-
maxLines := int64(50)
31+
maxLines := int64(1000)
3232
assert.NilError(t, wait.RegexpMatchingInControllerLog(ctx, g.Cnx, *regexp.MustCompile(".*fetched git-clone task"),
3333
10, "controller", &maxLines), "Error while checking the logs of the pipelines-as-code controller pod")
3434
defer g.TearDown(ctx, t)

test/github_pullrequest_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ func TestGithubPullandPushMatchTriggerOnlyPull(t *testing.T) {
683683
ctx = info.StoreNS(ctx, globalNs)
684684

685685
reg := regexp.MustCompile(fmt.Sprintf("Skipping push event for commit.*as it belongs to pull request #%d", g.PRNumber))
686-
maxLines := int64(100)
686+
maxLines := int64(1000)
687687
err = twait.RegexpMatchingInControllerLog(ctx, g.Cnx, *reg, 20, "controller", &maxLines)
688688
assert.NilError(t, err)
689689
}
@@ -743,7 +743,7 @@ func TestGithubIgnoreTagPushCommitsFromSkipPushEventsSetting(t *testing.T) {
743743
ctx = info.StoreNS(ctx, globalNs)
744744

745745
reg := regexp.MustCompile(fmt.Sprintf("Processing tag push event for commit %s despite skip-push-events-for-pr-commits being enabled.*", g.SHA))
746-
maxLines := int64(100)
746+
maxLines := int64(1000)
747747
err = twait.RegexpMatchingInControllerLog(ctx, g.Cnx, *reg, 20, "controller", &maxLines)
748748
assert.NilError(t, err)
749749

test/github_push_retest_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func TestGithubPushRequestGitOpsCommentCancel(t *testing.T) {
192192

193193
// this went too fast so at least we check it was requested for it
194194
if !cancelled {
195-
numLines := int64(20)
195+
numLines := int64(1000)
196196
reg := regexp.MustCompile(".*pipelinerun.*skipping cancelling pipelinerun.*on-push.*already done.*")
197197
err = twait.RegexpMatchingInControllerLog(ctx, g.Cnx, *reg, 10, "controller", &numLines)
198198
if err != nil {

test/github_skip_ci_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func verifySkipCI(ctx context.Context, t *testing.T, g *tgithub.PRTest, eventTyp
3838
assert.NilError(t, err)
3939

4040
// Verify controller logs mention skip command detection
41-
numLines := int64(100)
41+
numLines := int64(1000)
4242
skipLogRegex := regexp.MustCompile(fmt.Sprintf("CI skipped for %s event.*contains skip command in message", eventType))
4343
err = twait.RegexpMatchingInControllerLog(ctx, g.Cnx, *skipLogRegex, 10, "controller", &numLines)
4444
assert.NilError(t, err, "Expected controller logs to mention CI skip due to skip command")
@@ -106,7 +106,7 @@ func TestGithubSkipCITestCommand(t *testing.T) {
106106
assert.NilError(t, err)
107107

108108
// Verify controller logs mention skip command detection
109-
numLines := int64(100)
109+
numLines := int64(1000)
110110
skipLogRegex := regexp.MustCompile("CI skipped for pull request event.*contains skip command in message")
111111
err = twait.RegexpMatchingInControllerLog(ctx, g.Cnx, *skipLogRegex, 10, "controller", &numLines)
112112
assert.NilError(t, err, "Expected controller logs to mention CI skip due to skip command")

test/gitlab_delete_tag_event_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestGitlabDeleteTagEvent(t *testing.T) {
4646
assert.NilError(t, err)
4747
runcnx.Clients.Log.Infof("Deleted Tag %s in %s repository", tagName, projectinfo.Name)
4848

49-
logLinesToCheck := int64(100)
49+
logLinesToCheck := int64(1000)
5050
reg := regexp.MustCompile("event Delete Tag Push Hook is not supported*")
5151
err = twait.RegexpMatchingInControllerLog(ctx, runcnx, *reg, 10, "controller", &logLinesToCheck)
5252
assert.NilError(t, err)

test/invalid_event_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"gotest.tools/v3/assert"
1515
)
1616

17-
func TestUnsupportedEvent(t *testing.T) {
17+
func TestOthersUnsupportedEvent(t *testing.T) {
1818
ctx := context.TODO()
1919

2020
event := github.ReleaseEvent{}
@@ -48,7 +48,7 @@ func TestUnsupportedEvent(t *testing.T) {
4848
assert.Equal(t, resp.StatusCode, http.StatusOK, "%s reply expected 200 OK", elURL)
4949
}
5050

51-
func TestSkippedEvent(t *testing.T) {
51+
func TestOthersSkippedEvent(t *testing.T) {
5252
ctx := context.TODO()
5353

5454
event := github.PullRequestEvent{
@@ -84,7 +84,7 @@ func TestSkippedEvent(t *testing.T) {
8484
assert.Assert(t, resp.StatusCode >= 200 && resp.StatusCode < 300, "%s reply expected 2xx OK: %d", elURL, resp.StatusCode)
8585
}
8686

87-
func TestGETCall(t *testing.T) {
87+
func TestOthersGETCall(t *testing.T) {
8888
ctx := context.TODO()
8989

9090
elURL := os.Getenv("TEST_EL_URL")

test/repo_validation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1515
)
1616

17-
func TestRepoValidation(t *testing.T) {
17+
func TestOthersRepoValidation(t *testing.T) {
1818
ctx := context.TODO()
1919
run := params.New()
2020
assert.NilError(t, run.Clients.NewClients(ctx, &run.Info))

test/repository_webhook_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1414
)
1515

16-
func TestRepositoryCreation(t *testing.T) {
16+
func TestOthersRepositoryCreation(t *testing.T) {
1717
ctx := context.TODO()
1818
ctx, runcnx, _, _, err := ghtest.Setup(ctx, false, false)
1919
assert.NilError(t, err)

0 commit comments

Comments
 (0)