@@ -35,7 +35,7 @@ func TestInject(t *testing.T) {
35
35
cf := & mock.MockStore {}
36
36
container .ConfigRef ["mock_config_store" ] = cf
37
37
38
- injector := DefaultInjector { Container : * container }
38
+ injector := NewDefaultInjector ( container . SecretRef , container . ConfigRef )
39
39
meta := make (map [string ]string )
40
40
41
41
var items []* ref.SecretRefConfig
@@ -59,5 +59,25 @@ func TestInject(t *testing.T) {
59
59
injector .InjectSecretRef (items , meta )
60
60
assert .Equal (t , meta ["ref-key" ], "life is good" )
61
61
assert .Equal (t , meta ["good-key" ], "life is good" )
62
+ secretStoreRef , err := injector .InjectSecretStoreRef (& ref.ComponentRefConfig {
63
+ SecretStore : "fake_secret_store" ,
64
+ })
65
+ assert .Nil (t , err )
66
+ assert .Equal (t , secretStoreRef , ss )
67
+
68
+ _ , err = injector .InjectSecretStoreRef (& ref.ComponentRefConfig {
69
+ SecretStore : "null" ,
70
+ })
71
+ assert .NotNil (t , err )
62
72
73
+ configStoreRef , err := injector .InjectConfigStoreRef (& ref.ComponentRefConfig {
74
+ ConfigStore : "mock_config_store" ,
75
+ })
76
+ assert .Nil (t , err )
77
+ assert .Equal (t , configStoreRef , cf )
78
+
79
+ _ , err = injector .InjectConfigStoreRef (& ref.ComponentRefConfig {
80
+ ConfigStore : "null" ,
81
+ })
82
+ assert .NotNil (t , err )
63
83
}
0 commit comments