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

Function TestLoadDaemonSet

pkg/plugin/loader/loader_test.go:173–211  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

171}
172
173func TestLoadDaemonSet(t *testing.T) {
174 namespace := "loader_test"
175 image := "gcr.io/heptio-images/sonobuoy:latest"
176 daemonDef := manifest.Manifest{
177 SonobuoyConfig: manifest.SonobuoyConfig{
178 Driver: "DaemonSet",
179 PluginName: "test-daemon-set-plugin",
180 },
181 Spec: manifest.Container{
182 Container: corev1.Container{
183 Image: "gcr.io/heptio-images/heptio-e2e:master",
184 },
185 },
186 }
187
188 pluginIface, err := loadPlugin(daemonDef, namespace, image, "Always", "image-pull-secrets", nil)
189 if err != nil {
190 t.Fatalf("unexpected error loading plugin: %v", err)
191 }
192
193 daemonPlugin, ok := pluginIface.(*daemonset.Plugin)
194
195 if !ok {
196 t.Fatalf("loaded plugin not a daemon.Plugin")
197 }
198
199 if daemonPlugin.GetName() != "test-daemon-set-plugin" {
200 t.Errorf("expected plugin name 'test-daemon-set-plugin', got '%v'", daemonPlugin.GetName())
201 }
202 if daemonPlugin.Definition.Spec.Image != "gcr.io/heptio-images/heptio-e2e:master" {
203 t.Errorf("expected plugin name 'gcr.io/heptio-images/heptio-e2e:master', got '%v'", daemonPlugin.Definition.Spec.Image)
204 }
205 if daemonPlugin.Namespace != namespace {
206 t.Errorf("expected plugin name '%q', got '%v'", namespace, daemonPlugin.Namespace)
207 }
208 if daemonPlugin.ImagePullSecrets != "image-pull-secrets" {
209 t.Errorf("Expected imagePullSecrets with name %v but got %v", "image-pull-secret", daemonPlugin.ImagePullSecrets)
210 }
211}
212
213func TestFilterList(t *testing.T) {
214 definitions := []manifest.Manifest{

Callers

nothing calls this directly

Calls 2

loadPluginFunction · 0.70
GetNameMethod · 0.65

Tested by

no test coverage detected