defenseunicorns / pepr

Type safe K8s middleware for humans
https://pepr.dev
Apache License 2.0
208 stars 18 forks source link

Chuck Norris API service is down (503) which is making journey tests fail #897

Closed cmwylie19 closed 4 months ago

cmwylie19 commented 4 months ago

Describe what should be investigated or refactored

We just need to keep an eye on this for now to see if the service will come back up. If not we need to change the journey test.

When(a.ConfigMap)
  .IsCreated()
  .WithLabel("chuck-norris")
  .Mutate(async change => {
    // Try/catch is not needed as a response object will always be returned
    const response = await fetch<TheChuckNorrisJoke>(
      "https://api.chucknorris.io/jokes/random?category=dev",
    );

    // Instead, check the `response.ok` field
    if (response.ok) {
      // Add the Chuck Norris joke to the configmap
      change.Raw.data["chuck-says"] = response.data.value;
      return;
    }

    // You can also assert on different HTTP response codes
    if (response.status === fetchStatus.NOT_FOUND) {
      // Do something else
      return;
    }
  });
apiVersion: v1
kind: ConfigMap
metadata:
  name: example-5
  namespace: pepr-demo
  labels:
    chuck-norris: test
data:
  key: ex-5-val
  it("should mutate example-5", async () => {
    const cm5 = await waitForConfigMap("pepr-demo", "example-5");

    expect(cm5.metadata?.annotations?.["static-test.pepr.dev/hello-pepr"]).toBe("succeeded");
    expect(cm5.data?.["chuck-says"]).toBeTruthy();
  });

All tests were passing image but now it is not.

wget https://api.chucknorris.io/jokes/random\?category\=dev
--2024-06-17 17:47:20--  https://api.chucknorris.io/jokes/random?category=dev
Resolving api.chucknorris.io (api.chucknorris.io)... 104.21.9.74, 172.67.159.75
Connecting to api.chucknorris.io (api.chucknorris.io)|104.21.9.74|:443... connected.
HTTP request sent, awaiting response... 503 Service Unavailable
2024-06-17 17:47:51 ERROR 503: Service Unavailable.

Additional context

Add any other context or screenshots about the technical debt here.

cmwylie19 commented 4 months ago
wget https://api.chucknorris.io/jokes/random\?category\=dev
--2024-06-17 17:47:20--  https://api.chucknorris.io/jokes/random?category=dev
Resolving api.chucknorris.io (api.chucknorris.io)... 104.21.9.74, 172.67.159.75
Connecting to api.chucknorris.io (api.chucknorris.io)|104.21.9.74|:443... connected.
HTTP request sent, awaiting response... 503 Service Unavailable
2024-06-17 17:47:51 ERROR 503: Service Unavailable.