@@ -36,7 +36,7 @@ func TestNewConfigStore(t *testing.T) {
3636
3737 // Setup some config
3838 cm .Data = map [string ]string {}
39- cm .Data [taskrunFormatKey ] = "foo "
39+ cm .Data [taskrunSignerKey ] = "pgp "
4040
4141 if cm , err = fakekubeclient .CoreV1 ().ConfigMaps (ns ).Update (ctx , cm , metav1.UpdateOptions {}); err != nil {
4242 t .Errorf ("error updating configmap: %v" , err )
@@ -45,24 +45,24 @@ func TestNewConfigStore(t *testing.T) {
4545 // It should be updated by then...
4646 time .Sleep (100 * time .Millisecond )
4747 // Test that the values are set!
48- if diff := cmp .Diff ("foo " , cs .Config ().Artifacts .TaskRuns .Format ); diff != "" {
48+ if diff := cmp .Diff ("pgp " , cs .Config ().Artifacts .TaskRuns .Signer ); diff != "" {
4949 t .Error (diff )
5050 }
5151
5252 // Change it again
53- cm .Data [taskrunFormatKey ] = "bar "
53+ cm .Data [taskrunSignerKey ] = "kms "
5454
5555 if _ , err := fakekubeclient .CoreV1 ().ConfigMaps (ns ).Update (ctx , cm , metav1.UpdateOptions {}); err != nil {
5656 t .Errorf ("error updating configmap: %v" , err )
5757 }
5858 time .Sleep (100 * time .Millisecond )
5959 // Test that the values are set!
60- if diff := cmp .Diff ("bar " , cs .Config ().Artifacts .TaskRuns .Format ); diff != "" {
60+ if diff := cmp .Diff ("kms " , cs .Config ().Artifacts .TaskRuns .Signer ); diff != "" {
6161 t .Error (diff )
6262 }
6363}
6464
65- func Test_parse (t * testing.T ) {
65+ func TestParse (t * testing.T ) {
6666 tests := []struct {
6767 name string
6868 data map [string ]string
@@ -73,30 +73,51 @@ func Test_parse(t *testing.T) {
7373 data : map [string ]string {},
7474 want : Config {
7575 Artifacts : ArtifactConfigs {
76- TaskRuns : Artifact {},
76+ TaskRuns : Artifact {
77+ Format : "tekton" ,
78+ StorageBackend : "tekton" ,
79+ Signer : "x509" ,
80+ },
81+ OCI : Artifact {
82+ Format : "simplesigning" ,
83+ StorageBackend : "oci" ,
84+ Signer : "x509" ,
85+ },
7786 },
7887 },
7988 },
8089 {
8190 name : "single" ,
82- data : map [string ]string {taskrunFormatKey : "foo " },
91+ data : map [string ]string {taskrunSignerKey : "pgp " },
8392 want : Config {
8493 Artifacts : ArtifactConfigs {
8594 TaskRuns : Artifact {
86- Format : "foo" ,
87- StorageBackend : "" ,
95+ Format : "tekton" ,
96+ Signer : "pgp" ,
97+ StorageBackend : "tekton" ,
98+ },
99+ OCI : Artifact {
100+ Format : "simplesigning" ,
101+ StorageBackend : "oci" ,
102+ Signer : "x509" ,
88103 },
89104 },
90105 },
91106 },
92107 {
93108 name : "extra" ,
94- data : map [string ]string {taskrunFormatKey : "foo " , "other-key" : "foo" },
109+ data : map [string ]string {taskrunSignerKey : "pgp " , "other-key" : "foo" },
95110 want : Config {
96111 Artifacts : ArtifactConfigs {
97112 TaskRuns : Artifact {
98- Format : "foo" ,
99- StorageBackend : "" ,
113+ Format : "tekton" ,
114+ Signer : "pgp" ,
115+ StorageBackend : "tekton" ,
116+ },
117+ OCI : Artifact {
118+ Format : "simplesigning" ,
119+ StorageBackend : "oci" ,
120+ Signer : "x509" ,
100121 },
101122 },
102123 },
0 commit comments