Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit a7130f9

Browse files
authored
ci: fix aspect regression and add test (#61252)
1 parent f334fc0 commit a7130f9

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

dev/ci/internal/ci/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ go_library(
4343
go_test(
4444
name = "ci_test",
4545
srcs = [
46+
"aspect_workflows_test.go",
4647
"bazel_operations_test.go",
4748
"wolfi_operations_test.go",
4849
],

dev/ci/internal/ci/aspect_workflows.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package ci
22

3+
import "fmt"
4+
35
var AspectWorkflows = struct {
46
// TestStepKey is the key of the primary test step
57
TestStepKey string
@@ -20,9 +22,10 @@ var AspectWorkflows = struct {
2022
QueueSmall: "aspect-small",
2123
}
2224

25+
const AspectGeneratedBazelRCPath = "/tmp/aspect-generated.bazelrc"
26+
2327
func aspectBazelRC() (string, string) {
24-
path := "/tmp/aspect-generated.bazelrc"
25-
bazelRCCmd := "rosetta bazelrc > " + path
28+
bazelRCCmd := fmt.Sprintf("rosetta bazelrc > %s;", AspectGeneratedBazelRCPath)
2629

27-
return bazelRCCmd, path
30+
return bazelRCCmd, AspectGeneratedBazelRCPath
2831
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package ci
2+
3+
import (
4+
"strings"
5+
"testing"
6+
)
7+
8+
func TestAspectBazelRC(t *testing.T) {
9+
cmd, path := aspectBazelRC()
10+
11+
if path != AspectGeneratedBazelRCPath {
12+
t.Fatalf("expected path to be %s, got %s", AspectGeneratedBazelRCPath, path)
13+
}
14+
15+
// cmd should end with a semicolon so that it can be executed on its own and not interfere with other commands
16+
if !strings.HasSuffix(cmd, ";") {
17+
t.Fatalf("expected command to end with ';', got %s", cmd)
18+
}
19+
}

0 commit comments

Comments
 (0)