(t *testing.T)
| 38 | ) |
| 39 | |
| 40 | func TestOpenAPIKnativeContractFirst(t *testing.T) { |
| 41 | t.Parallel() |
| 42 | WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { |
| 43 | name := RandomizedSuffixName("petstore") |
| 44 | openapiContent, err := os.ReadFile("./files/petstore-api.yaml") |
| 45 | require.NoError(t, err) |
| 46 | var cmDataProps = make(map[string]string) |
| 47 | cmDataProps["petstore-api.yaml"] = string(openapiContent) |
| 48 | CreatePlainTextConfigmap(t, ctx, ns, "my-openapi", cmDataProps) |
| 49 | |
| 50 | g.Expect(KamelRun(t, ctx, ns, |
| 51 | "--name", name, "--resource", "configmap:my-openapi", "files/petstore-cf.yaml"). |
| 52 | Execute()).To(Succeed()) |
| 53 | |
| 54 | g.Eventually(KnativeService(t, ctx, ns, name), TestTimeoutLong). |
| 55 | Should(Not(BeNil())) |
| 56 | g.Eventually(IntegrationConditionStatus(t, ctx, ns, name, v1.IntegrationConditionReady), TestTimeoutMedium). |
| 57 | Should(Equal(corev1.ConditionTrue)) |
| 58 | g.Eventually(IntegrationPodPhase(t, ctx, ns, name)).Should(Equal(corev1.PodRunning)) |
| 59 | // Let's make sure the Integration is ready to receive traffic |
| 60 | g.Eventually(IntegrationLogs(t, ctx, ns, name)).Should(ContainSubstring("Listening on: http://0.0.0.0:8080")) |
| 61 | pod := IntegrationPod(t, ctx, ns, name)() |
| 62 | g.Expect(pod).NotTo(BeNil()) |
| 63 | response, err := TestClient(t).CoreV1().RESTClient().Get(). |
| 64 | Timeout(30 * time.Second). |
| 65 | AbsPath(fmt.Sprintf("/api/v1/namespaces/%s/pods/%s/proxy/v1/pets", pod.Namespace, pod.Name)). |
| 66 | DoRaw(ctx) |
| 67 | require.NoError(t, err) |
| 68 | assert.Equal(t, "listPets", string(response)) |
| 69 | }) |
| 70 | } |
nothing calls this directly
no test coverage detected