operator-framework / catalogd

On-cluster FBC catalog content server
Apache License 2.0
16 stars 32 forks source link

🐛 Check cluster is running for non-standalone Make targets #437

Closed bentito closed 2 weeks ago

bentito commented 1 month ago

We have several non-standlone Make targets

The above targets rely on Kind to be running.

Unfortunately, currently, errors returned from the Go code are pretty cryptic. Better would be an explicit catch and error when a Kind cluster is not found when these targets are run.

Currently we have:

catalogd checking_kind_running $ make test-e2e
/Users/btofel/go/bin/ginkgo-v2.20.2  -trace -vv  test/e2e
Running Suite: E2E Suite - /Users/btofel/workspace/catalogd/test/e2e
====================================================================
Random Seed: 1729265504

Will run 1 of 1 specs
------------------------------
[BeforeSuite]
/Users/btofel/workspace/catalogd/test/e2e/e2e_suite_test.go:33
  > Enter [BeforeSuite] TOP-LEVEL - /Users/btofel/workspace/catalogd/test/e2e/e2e_suite_test.go:33 @ 10/18/24 11:31:49.369

Ginkgo ran 1 suite in 4.681573708s

Test Suite Failed
make: *** [test-e2e] Error 1

wha?

but it would be better to have:

$ make test-e2e
if ! kubectl config current-context >/dev/null 2>&1; then \
        echo "Error: Could not get current Kubernetes context. Use 'run' or 'e2e' targets first."; \
        exit 1; \
    fi
Error: Could not get current Kubernetes context. Use 'run' or 'e2e' targets first.
make: *** [check-cluster] Error 1
codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 38.23%. Comparing base (4d6327f) to head (2f186ef). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #437 +/- ## ======================================= Coverage 38.23% 38.23% ======================================= Files 15 15 Lines 1224 1224 ======================================= Hits 468 468 Misses 706 706 Partials 50 50 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

camilamacedo86 commented 1 week ago

Hi @bentito

If you see the logs https://github.com/operator-framework/catalogd/actions/runs/11819448861/job/32929383546 (ci job of this PR)you will see that this check is wrong and is always failing:

Screenshot 2024-11-18 at 08 16 07

I do not see the need for this check. Instead, I would prefer the targets of this project to be as similar as possible to those of https://github.com/operator-framework/operator-controller so that life for us contributors is easier.

c/c @grokspawn