MCPcopy Create free account
hub / github.com/apache/camel-k / TestOpenAPIKnativeContractFirst

Function TestOpenAPIKnativeContractFirst

e2e/knative/openapi_test.go:40–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

38)
39
40func 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}

Callers

nothing calls this directly

Calls 13

WithNewTestNamespaceFunction · 0.85
RandomizedSuffixNameFunction · 0.85
CreatePlainTextConfigmapFunction · 0.85
KamelRunFunction · 0.85
KnativeServiceFunction · 0.85
IntegrationPodPhaseFunction · 0.85
IntegrationLogsFunction · 0.85
IntegrationPodFunction · 0.85
TestClientFunction · 0.85
EqualMethod · 0.80
GetMethod · 0.65

Tested by

no test coverage detected