MCPcopy
hub / github.com/vmware-tanzu/sonobuoy / TestRunGlobal_noExtension

Function TestRunGlobal_noExtension

pkg/worker/worker_test.go:93–116  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

91}
92
93func TestRunGlobal_noExtension(t *testing.T) {
94
95 // Create an expectedResults array
96 expectedResults := []plugin.ExpectedResult{
97 {ResultType: "systemd_logs", NodeName: "global"},
98 }
99
100 withAggregator(t, expectedResults, func(aggr *aggregation.Aggregator, srv *authtest.Server) {
101 url, err := aggregation.GlobalResultURL(srv.URL, "systemd_logs")
102 if err != nil {
103 t.Fatalf("unexpected error getting global result url %v", err)
104 }
105 withTempDir(t, func(tmpdir string) {
106 os.WriteFile(filepath.Join(tmpdir, "systemd_logs"), []byte("{}"), 0755)
107 os.WriteFile(filepath.Join(tmpdir, "done"), []byte(filepath.Join(tmpdir, "systemd_logs")), 0755)
108 err := GatherResults(filepath.Join(tmpdir, "done"), url, srv.Client(), nil)
109 if err != nil {
110 t.Fatalf("Got error running agent: %v", err)
111 }
112
113 ensureExists(t, filepath.Join(aggr.OutputDir, "systemd_logs", "results"))
114 })
115 })
116}
117
118func TestRunGlobalCleanup(t *testing.T) {
119

Callers

nothing calls this directly

Calls 6

GlobalResultURLFunction · 0.92
withTempDirFunction · 0.85
GatherResultsFunction · 0.85
ensureExistsFunction · 0.85
withAggregatorFunction · 0.70
ClientMethod · 0.45

Tested by

no test coverage detected