diff --git a/pkg/config/loader_test.go b/pkg/config/loader_test.go index 4f707cf1b..224c75151 100644 --- a/pkg/config/loader_test.go +++ b/pkg/config/loader_test.go @@ -108,6 +108,7 @@ func TestLoadAllPlugins(t *testing.T) { PluginSelections: []plugin.Selection{ plugin.Selection{Name: "systemd_logs"}, plugin.Selection{Name: "e2e"}, + plugin.Selection{Name: "heptio-check"}, }, } @@ -121,18 +122,23 @@ func TestLoadAllPlugins(t *testing.T) { t.Fatal(err.Error()) } plugins := cfg.getPlugins() - if len(plugins) != 2 { - t.Fatalf("Should have constructed 2 plugins, got %v", len(plugins)) + if len(plugins) != len(cfg.PluginSelections) { + t.Fatalf("Should have constructed %v plugins, got %v", len(cfg.PluginSelections), len(plugins)) } - dsplugin := plugins[0] - if name := dsplugin.GetName(); name != "systemd_logs" { - t.Fatalf("First result of LoadAllPlugins has the wrong name: %v != systemd_logs", name) - } - - jobplugin := plugins[1] - if name := jobplugin.GetName(); name != "e2e" { - t.Fatalf("Second result of LoadAllPlugins has the wrong name: %v != e2e", name) + for _, selection := range cfg.PluginSelections { + found := false + for _, loadedPlugin := range plugins { + if loadedPlugin.GetName() == selection.Name { + found = true + } + } + if !found { + pluginNames := make([]string, len(plugins)) + for i, plugin := range plugins { + pluginNames[i] = plugin.GetName() + } + t.Fatalf("Expected to find %v in %v", selection.Name, pluginNames) + } } - } diff --git a/plugins.d/heptio-e2e.tmpl b/plugins.d/heptio-e2e.tmpl new file mode 100644 index 000000000..cd13458d9 --- /dev/null +++ b/plugins.d/heptio-e2e.tmpl @@ -0,0 +1,55 @@ +apiVersion: v1 +kind: Pod +metadata: + annotations: + sonobuoy-driver: Job + sonobuoy-plugin: heptio-check + sonobuoy-result-type: heptio-check + labels: + component: sonobuoy + sonobuoy-run: '{{.SessionID}}' + tier: analysis + name: heptio-check + namespace: '{{.Namespace}}' +spec: + containers: + - image: 'gcr.io/heptio-images/heptio-e2e:latest' + imagePullPolicy: Always + name: 'sonobuoy-heptio-check-job-{{.SessionID}}' + volumeMounts: + - mountPath: /tmp/results + name: results + readOnly: false + - command: + - sh + - '-c' + - /sonobuoy worker global -v 5 --logtostderr + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: RESULTS_DIR + value: /tmp/results + - name: MASTER_URL + value: '{{.MasterAddress}}' + - name: RESULT_TYPE + value: heptio-check + image: 'gcr.io/heptio-images/sonobuoy:latest' + imagePullPolicy: Always + name: sonobuoy-worker + volumeMounts: + - mountPath: /tmp/results + name: results + readOnly: false + restartPolicy: Never + serviceAccountName: sonobuoy-serviceaccount + tolerations: + - effect: NoSchedule + key: node-role.kubernetes.io/master + operator: Exists + - key: CriticalAddonsOnly + operator: Exists + volumes: + - emptyDir: {} + name: results