capi2argo-cluster-operator icon indicating copy to clipboard operation
capi2argo-cluster-operator copied to clipboard

Ginkgo v2 test migration

Open 65278 opened this issue 1 year ago • 0 comments

I ran into issues when writing a pull request with actual full controller tests, specifically when moving the ginkgo testsuite tear down to AfterSuite():

[...]
=== NAME  TestReconcile                                                                                                                                                                       
    capi2argo_reconciler_test.go:84:                                                                                                                                                          
                Error Trace:    /home/felix/ionos/capi2argo-cluster-operator2/controllers/capi2argo_reconciler_test.go:84                                                                     
                Error:          Expected nil, but got: &url.Error{Op:"Post", URL:"https://127.0.0.1:34087/api/v1/namespaces", Err:(*net.OpError)(0xc000030000)}                               
                Test:           TestReconcile 
[...]
panic: test timed out after 10m0s                                                                                                                                                             
running tests:
        TestReconcile/process_secret_with_wrong_Data[key] (9m56s)
        TestReconcile/process_secret_with_wrong_Type (9m56s)
        TestReconcile/process_valid_secret (9m56s)

After much debugging, I came to the conclusion that the test suite never properly worked for requests which hit the api server since it's missing the required schemes and crds to properly function.

As such, I've moved the controller tests to ginkgo/v2. On the way there, module vendoring gave me issues when trying to import CRDs (those aren't vendored), so I've removed it. Commit 1 and 2 are just concerned with removing vendored modules, commit 3 does the actual work.

65278 avatar Aug 19 '24 14:08 65278