MCPcopy
hub / github.com/helmfile/helmfile / TestParallelProcessingDeterministicOutput

Function TestParallelProcessingDeterministicOutput

pkg/app/app_parallel_test.go:17–85  ·  view source on GitHub ↗

TestParallelProcessingDeterministicOutput verifies that ListReleases produces consistent sorted output even with parallel processing of multiple helmfile.d files

(t *testing.T)

Source from the content-addressed store, hash-verified

15// TestParallelProcessingDeterministicOutput verifies that ListReleases produces
16// consistent sorted output even with parallel processing of multiple helmfile.d files
17func TestParallelProcessingDeterministicOutput(t *testing.T) {
18 files := map[string]string{
19 "/path/to/helmfile.d/z-last.yaml": `
20releases:
21- name: zulu-release
22 chart: stable/chart-z
23 namespace: ns-z
24`,
25 "/path/to/helmfile.d/a-first.yaml": `
26releases:
27- name: alpha-release
28 chart: stable/chart-a
29 namespace: ns-a
30`,
31 "/path/to/helmfile.d/m-middle.yaml": `
32releases:
33- name: mike-release
34 chart: stable/chart-m
35 namespace: ns-m
36`,
37 }
38
39 // Run ListReleases multiple times to verify consistent ordering
40 var outputs []string
41 for i := 0; i < 5; i++ {
42 var buffer bytes.Buffer
43 syncWriter := testhelper.NewSyncWriter(&buffer)
44 logger := helmexec.NewLogger(syncWriter, "debug")
45
46 valsRuntime, err := vals.New(vals.Options{CacheSize: 32})
47 if err != nil {
48 t.Fatalf("unexpected error creating vals runtime: %v", err)
49 }
50
51 app := appWithFs(&App{
52 OverrideHelmBinary: DefaultHelmBinary,
53 fs: ffs.DefaultFileSystem(),
54 OverrideKubeContext: "default",
55 DisableKubeVersionAutoDetection: true,
56 Env: "default",
57 Logger: logger,
58 valsRuntime: valsRuntime,
59 FileOrDir: "/path/to/helmfile.d",
60 }, files)
61
62 expectNoCallsToHelm(app)
63
64 err = app.ListReleases(configImpl{
65 skipCharts: false,
66 output: "table",
67 })
68
69 if err != nil {
70 t.Fatalf("unexpected error on iteration %d: %v", i, err)
71 }
72
73 outputs = append(outputs, buffer.String())
74 }

Callers

nothing calls this directly

Calls 6

NewSyncWriterFunction · 0.92
NewLoggerFunction · 0.92
appWithFsFunction · 0.85
expectNoCallsToHelmFunction · 0.85
ListReleasesMethod · 0.80
StringMethod · 0.80

Tested by

no test coverage detected