Skip to content

Commit d8046cf

Browse files
chmouelpipelines-as-code[bot]
authored andcommitted
test: PullRequestPrivateRepository use 100 lines
While looking inside the controller for the TestGiteaPullRequestPrivateRepository test, we were watching the last 20 lines. but looking at the failure error the error was showing 50 lines earlier due of more logs generated with the test-comment version. cf: https://paste.openstack.org/raw/b4q0ytPl4EQdTn54A5pC/ let's do 100 since that should be fine for the future.
1 parent e65447c commit d8046cf

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

test/gitea_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ func TestGiteaPullRequestPrivateRepository(t *testing.T) {
151151
}
152152
ctx, f := tgitea.TestPR(t, topts)
153153
defer f()
154-
reg := regexp.MustCompile(".*fetched git-clone task")
155-
maxLines := int64(20)
154+
reg := regexp.MustCompile(".*successfully fetched git-clone task from default configured catalog HUB")
155+
maxLines := int64(100)
156156
err := twait.RegexpMatchingInControllerLog(ctx, topts.ParamsRun, *reg, 20, "controller", &maxLines)
157157
assert.NilError(t, err)
158158
tgitea.WaitForSecretDeletion(t, topts, topts.TargetRefName)

test/github_pullrequest_concurrency_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func testGithubConcurrency(ctx context.Context, t *testing.T, g tgithub.PRTest,
219219
prs, err := g.Cnx.Clients.Tekton.TektonV1().PipelineRuns(g.TargetNamespace).List(ctx, metav1.ListOptions{})
220220
assert.NilError(t, err)
221221
sort.PipelineRunSortByStartTime(prs.Items)
222-
for i := 0; i < numberOfPipelineRuns; i++ {
222+
for i := range make([]int, numberOfPipelineRuns) {
223223
prExpectedName := fmt.Sprintf("%s%d", pipelineRunFileNamePrefix, len(prs.Items)-i)
224224
prActualName := prs.Items[i].GetName()
225225
assert.Assert(t, strings.HasPrefix(prActualName, prExpectedName), "prActualName: %s does not start with expected prefix %s, was is ordered properly at start time", prActualName, prExpectedName)
@@ -230,7 +230,7 @@ func testGithubConcurrency(ctx context.Context, t *testing.T, g tgithub.PRTest,
230230
func waitForPipelineRunsHasStarted(ctx context.Context, t *testing.T, g tgithub.PRTest, numberOfPipelineRuns int) {
231231
finished := false
232232
maxLoop := 30
233-
for i := 0; i < maxLoop; i++ {
233+
for i := range make([]int, maxLoop) {
234234
unsuccessful := 0
235235
prs, err := g.Cnx.Clients.Tekton.TektonV1().PipelineRuns(g.TargetNamespace).List(ctx, metav1.ListOptions{})
236236
assert.NilError(t, err)
@@ -256,6 +256,11 @@ func waitForPipelineRunsHasStarted(ctx context.Context, t *testing.T, g tgithub.
256256
time.Sleep(10 * time.Second)
257257
}
258258
if !finished {
259+
prs, err := g.Cnx.Clients.Tekton.TektonV1().PipelineRuns(g.TargetNamespace).List(ctx, metav1.ListOptions{})
260+
assert.NilError(t, err)
261+
for _, pr := range prs.Items {
262+
t.Logf("PipelineRun %s has conditions: %v", pr.GetName(), pr.Status.Conditions)
263+
}
259264
t.Errorf("the %d pipelineruns has not successfully finished, some of them are still pending or it's abnormally slow to process the Q", numberOfPipelineRuns)
260265
}
261266
}

0 commit comments

Comments
 (0)