Skip to content

Commit 0675862

Browse files
authored
Merge pull request #18076 from justinsb/write_everything_to_tests_folder
[aiconformance]: unify output under tests/ directory
2 parents 7725931 + b6998d0 commit 0675862

File tree

2 files changed

+5
-24
lines changed

2 files changed

+5
-24
lines changed

tests/e2e/scenarios/ai-conformance/validators/kube.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ func (h *ValidatorHarness) dumpNamespaceResources(ctx context.Context, ns string
231231
}
232232

233233
testName := strings.ReplaceAll(h.t.Name(), "/", "_")
234-
clusterInfoDir := filepath.Join(artifactsDir, "per-test", testName, "cluster-info", ns)
234+
clusterInfoDir := filepath.Join(artifactsDir, "tests", testName, "cluster-info", ns)
235235
if err := os.MkdirAll(clusterInfoDir, 0o755); err != nil {
236236
h.Logf("failed to create cluster-info directory: %v", err)
237237
return

tests/e2e/scenarios/ai-conformance/validators/markdown.go

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"fmt"
2121
"os"
2222
"path/filepath"
23-
"runtime"
23+
"strings"
2424
"testing"
2525
)
2626

@@ -73,34 +73,15 @@ func (o *MarkdownOutput) printf(format string, args ...interface{}) {
7373
}
7474
}
7575

76-
// createMarkdownOutput creates a MarkdownOutput that writes to a file based on the test's name and location.
76+
// createMarkdownOutput creates a MarkdownOutput that writes to a file based on the test's name.
7777
func createMarkdownOutput(t *testing.T) OutputSink {
78-
// Get file path and other info from the current caller frame (depth 0)
79-
_, testFilename, _, ok := runtime.Caller(2)
80-
if !ok {
81-
t.Fatal("Could not get test caller")
82-
}
83-
_, baseFilename, _, ok := runtime.Caller(1)
84-
if !ok {
85-
t.Fatal("Could not get test caller")
86-
}
87-
88-
baseDir := filepath.Dir(baseFilename)
89-
90-
testRelativePath, err := filepath.Rel(baseDir, testFilename)
91-
if err != nil {
92-
t.Fatalf("failed to get relative path: %v", err)
93-
}
94-
95-
testRelativeDir := filepath.Dir(testRelativePath)
96-
9778
artifactsDir := os.Getenv("ARTIFACTS")
9879
if artifactsDir == "" {
9980
artifactsDir = "_artifacts"
10081
}
101-
outputBase := filepath.Join(artifactsDir, "ai-conformance")
10282

103-
outputPath := filepath.Join(outputBase, testRelativeDir, t.Name()+".md")
83+
testName := strings.ReplaceAll(t.Name(), "/", "_")
84+
outputPath := filepath.Join(artifactsDir, "tests", testName, "output.md")
10485

10586
if err := os.MkdirAll(filepath.Dir(outputPath), 0755); err != nil {
10687
t.Fatalf("failed to create output directory %v: %v", filepath.Dir(outputPath), err)

0 commit comments

Comments
 (0)