Skip to content

Commit 3009240

Browse files
committed
Fixed flaky test by ensuring unique timestamps in branch mode tests.
1 parent 51f5ae1 commit 3009240

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tests/Functional/BranchModeTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function testPackageMoreCommits(): void {
5858

5959
$this->gitCreateFixtureCommits(3, 2);
6060

61-
$this->now = time() - rand(1, 10 * 60);
61+
$this->now -= rand(1, 10 * 60);
6262
$branch2 = 'testbranch-' . date('Y-m-d_H-i-s', $this->now);
6363
$output = $this->assertArtifactCommandSuccess(['--branch' => 'testbranch-[timestamp:Y-m-d_H-i-s]'], $branch2);
6464
$this->assertStringContainsString('Remote branch: ' . $branch2, $output);
@@ -105,7 +105,7 @@ public function testGitignore(): void {
105105
// Now, remove the .gitignore and push again.
106106
$this->fixtureRemoveFile($this->src, '.gitignore');
107107
$this->gitCommitAll($this->src, 'Commit number 3');
108-
$this->now = time() - rand(1, 10 * 60);
108+
$this->now -= rand(1, 10 * 60);
109109
$branch2 = 'testbranch-' . date('Y-m-d_H-i-s', $this->now);
110110
$this->assertArtifactCommandSuccess(['--branch' => 'testbranch-[timestamp:Y-m-d_H-i-s]'], $branch2);
111111

@@ -135,7 +135,7 @@ public function testGitignoreCustom(): void {
135135
$this->fixtureCreateFile($this->src, 'f3');
136136
$this->fixtureRemoveFile($this->src, 'mygitignore');
137137
$this->gitCommitAll($this->src, 'Commit number 3');
138-
$this->now = time() - rand(1, 10 * 60);
138+
$this->now -= rand(1, 10 * 60);
139139
$branch2 = 'testbranch-' . date('Y-m-d_H-i-s', $this->now);
140140
$this->assertArtifactCommandSuccess(['--branch' => 'testbranch-[timestamp:Y-m-d_H-i-s]'], $branch2);
141141

0 commit comments

Comments
 (0)