From e0882e69c350a685c586a00d72a92e306374c146 Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 14 May 2025 07:18:35 -0600 Subject: test: use generic type --- test/integration/container_test.go | 2 +- test/integration/http.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/integration/container_test.go b/test/integration/container_test.go index 6c371ba..2d68236 100644 --- a/test/integration/container_test.go +++ b/test/integration/container_test.go @@ -74,7 +74,7 @@ func TestContainer(t *testing.T) { response := HttpGet(t, ctx, envoyAdminEndpoint+"/config_dump") require.Equal(t, http.StatusOK, response.StatusCode) - body := JSONBody(t, response) + body := JSONBody[map[string]interface{}](t, response) assert.NotEmpty(t, "listener_0", body["configs"]) }) diff --git a/test/integration/http.go b/test/integration/http.go index 452c56d..20991a2 100644 --- a/test/integration/http.go +++ b/test/integration/http.go @@ -36,8 +36,8 @@ func HttpGet(t *testing.T, ctx context.Context, path string) *http.Response { return response } -func JSONBody(t *testing.T, r *http.Response) map[string]interface{} { - item, err := serde.FromJSON[map[string]interface{}](r.Body) +func JSONBody[T any](t *testing.T, r *http.Response) T { + item, err := serde.FromJSON[T](r.Body) require.NoError(t, err) return item } -- cgit v1.2.3