mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-11-08 14:54:51 -05:00
fix tests
Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
parent
b9077150f8
commit
c21d2acd8b
5 changed files with 19 additions and 37 deletions
|
|
@ -39,7 +39,6 @@ go_deps.from_file(go_work = "//:go.work")
|
|||
use_repo(
|
||||
go_deps,
|
||||
"cat_dario_mergo",
|
||||
"com_github_aws_aws_sdk_go",
|
||||
"com_github_aws_aws_sdk_go_v2",
|
||||
"com_github_aws_aws_sdk_go_v2_config",
|
||||
"com_github_aws_aws_sdk_go_v2_credentials",
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ func TestBackupCRDs(t *testing.T) {
|
|||
}{
|
||||
"success": {
|
||||
upgradeID: "1234",
|
||||
crd: "apiVersion: \nkind: \nmetadata:\n name: foobar\n creationTimestamp: null\nspec:\n group: \"\"\n names:\n kind: \"somename\"\n plural: \"somenames\"\n scope: \"\"\n versions: null\nstatus:\n acceptedNames:\n kind: \"\"\n plural: \"\"\n conditions: null\n storedVersions: null\n",
|
||||
expectedFile: "apiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n name: foobar\n creationTimestamp: null\nspec:\n group: \"\"\n names:\n kind: \"somename\"\n plural: \"somenames\"\n scope: \"\"\n versions: null\nstatus:\n acceptedNames:\n kind: \"\"\n plural: \"\"\n conditions: null\n storedVersions: null\n",
|
||||
crd: "apiVersion: \nkind: \nmetadata:\n name: foobar\nspec:\n group: \"\"\n names:\n kind: \"somename\"\n plural: \"somenames\"\n scope: \"\"\n versions: null\nstatus:\n acceptedNames:\n kind: \"\"\n plural: \"\"\n conditions: null\n storedVersions: null\n",
|
||||
expectedFile: "apiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n name: foobar\nspec:\n group: \"\"\n names:\n kind: \"somename\"\n plural: \"somenames\"\n scope: \"\"\n versions: null\nstatus:\n acceptedNames:\n kind: \"\"\n plural: \"\"\n conditions: null\n storedVersions: null\n",
|
||||
},
|
||||
"api request fails": {
|
||||
upgradeID: "1234",
|
||||
|
|
|
|||
|
|
@ -42,14 +42,12 @@ func TestConfigMaps(t *testing.T) {
|
|||
data:
|
||||
key: value1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
key: value2
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
`, string(data))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,8 +41,7 @@ func TestMarshalK8SResources(t *testing.T) {
|
|||
data:
|
||||
key: value
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
`,
|
||||
},
|
||||
"Multiple fields are correctly encoded": {
|
||||
|
|
@ -73,15 +72,13 @@ metadata:
|
|||
data:
|
||||
key: value
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
key: dmFsdWU=
|
||||
kind: Secret
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
`,
|
||||
},
|
||||
"Non-pointer is detected": {
|
||||
|
|
@ -134,8 +131,7 @@ func TestUnmarshalK8SResources(t *testing.T) {
|
|||
data:
|
||||
key: value
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
`,
|
||||
into: &struct {
|
||||
ConfigMap k8s.ConfigMap
|
||||
|
|
@ -159,15 +155,13 @@ metadata:
|
|||
data:
|
||||
key: value
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
key: dmFsdWU=
|
||||
kind: Secret
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
`,
|
||||
into: &struct {
|
||||
ConfigMap k8s.ConfigMap
|
||||
|
|
@ -202,15 +196,13 @@ metadata:
|
|||
data:
|
||||
key: value
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
key: dmFsdWU=
|
||||
kind: Secret
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
`,
|
||||
into: &struct {
|
||||
ConfigMap k8s.ConfigMap
|
||||
|
|
@ -238,8 +230,7 @@ metadata:
|
|||
data:
|
||||
key: value
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
`,
|
||||
into: &struct {
|
||||
String string
|
||||
|
|
@ -251,8 +242,7 @@ metadata:
|
|||
data:
|
||||
key: value
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
`,
|
||||
into: &struct {
|
||||
Secret k8s.Secret
|
||||
|
|
@ -301,8 +291,7 @@ func TestMarshalK8SResourcesList(t *testing.T) {
|
|||
data:
|
||||
key: value
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
`,
|
||||
},
|
||||
"Multiple fields are correctly encoded": {
|
||||
|
|
@ -330,15 +319,13 @@ metadata:
|
|||
data:
|
||||
key: value
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
key: dmFsdWU=
|
||||
kind: Secret
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
`,
|
||||
},
|
||||
"Nil resource pointer is encodes": {
|
||||
|
|
|
|||
|
|
@ -42,14 +42,12 @@ func TestSecrets(t *testing.T) {
|
|||
data:
|
||||
key: dmFsdWUx
|
||||
kind: Secret
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
key: dmFsdWUy
|
||||
kind: Secret
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
metadata: {}
|
||||
`, string(data))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue