From 8250265e9fe463db253d6b1c55c8ec8c61373588 Mon Sep 17 00:00:00 2001 From: Mustafa Abdelrahman Date: Tue, 1 Aug 2023 17:20:18 +0200 Subject: [PATCH] Use yaml for test data Signed-off-by: Mustafa Abdelrahman --- .../definitions/definitions_test.go | 6 +-- .../testdata/errorwrapdata/routegroups.json | 41 ------------------- .../testdata/errorwrapdata/routegroups.yaml | 21 ++++++++++ 3 files changed, 24 insertions(+), 44 deletions(-) delete mode 100644 dataclients/kubernetes/definitions/testdata/errorwrapdata/routegroups.json create mode 100644 dataclients/kubernetes/definitions/testdata/errorwrapdata/routegroups.yaml diff --git a/dataclients/kubernetes/definitions/definitions_test.go b/dataclients/kubernetes/definitions/definitions_test.go index 388b026694..b145473a5e 100644 --- a/dataclients/kubernetes/definitions/definitions_test.go +++ b/dataclients/kubernetes/definitions/definitions_test.go @@ -14,11 +14,11 @@ func TestRouteGroupValidation(t *testing.T) { kubernetestest.FixturesToTest(t, "testdata/validation") } -func TestRouteGroupsValidationErrorWrapping(t *testing.T) { - data, err := os.ReadFile("testdata/errorwrapdata/routegroups.json") +func TestValidateRouteGroups(t *testing.T) { + data, err := os.ReadFile("testdata/errorwrapdata/routegroups.yaml") require.NoError(t, err) - rgl, err := definitions.ParseRouteGroupsJSON(data) + rgl, err := definitions.ParseRouteGroupsYAML(data) require.NoError(t, err) err = definitions.ValidateRouteGroups(&rgl) diff --git a/dataclients/kubernetes/definitions/testdata/errorwrapdata/routegroups.json b/dataclients/kubernetes/definitions/testdata/errorwrapdata/routegroups.json deleted file mode 100644 index 33a858ccfd..0000000000 --- a/dataclients/kubernetes/definitions/testdata/errorwrapdata/routegroups.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "items": [ - { - "apiVersion": "zalando.org/v1", - "kind": "RouteGroup", - "spec": { - "hosts": [ - "test.example.com" - ], - "routes": [ - { - "filters": [ - "inlineContent(\"/foo\")" - ], - "path": "/foo" - } - ] - } - }, - { - "apiVersion": "zalando.org/v1", - "metadata": { - "name": "rg1" - }, - "kind": "RouteGroup", - "spec": { - "hosts": [ - "test.example.com" - ], - "routes": [ - { - "filters": [ - "inlineContent(\"/foo\")" - ], - "path": "/foo" - } - ] - } - } - ] -} \ No newline at end of file diff --git a/dataclients/kubernetes/definitions/testdata/errorwrapdata/routegroups.yaml b/dataclients/kubernetes/definitions/testdata/errorwrapdata/routegroups.yaml new file mode 100644 index 0000000000..93dc6aa031 --- /dev/null +++ b/dataclients/kubernetes/definitions/testdata/errorwrapdata/routegroups.yaml @@ -0,0 +1,21 @@ +items: + - apiVersion: zalando.org/v1 + kind: RouteGroup + spec: + hosts: + - test.example.com + routes: + - filters: + - inlineContent("/foo") + - path: /foo + - apiVersion: zalando.org/v1 + kind: RouteGroup + metadata: + name: rg1 + spec: + hosts: + - test.example.com + routes: + - filters: + - inlineContent("/foo") + - path: /foo \ No newline at end of file