k8up-io / k8up

Kubernetes and OpenShift Backup Operator
https://k8up.io/
Apache License 2.0
601 stars 62 forks source link

Add full podSpec to all job types #968

Closed Kidswiss closed 2 months ago

Kidswiss commented 2 months ago

Summary

With this commit it's now possible to specify a full podSpec for each job type available.

Checklist

For Code changes

Kidswiss commented 2 months ago

Still working on the docs, but the code should already be ready for review.

Kidswiss commented 2 months ago

make test is broken

ok      github.com/k8up-io/k8up/v2/operator/locker      0.019s  coverage: 29.5% of statements
--- FAIL: TestRestore_args (0.00s)
    --- FAIL: TestRestore_args/givenS3RestoreResource_whenArgs_expectS3RestoreType (0.00s)
        executor_test.go:255: 
                Error Trace:    /home/wejdross/vshn/shedar/k8up/operator/restorecontroller/executor_test.go:255
                Error:          Not equal: 
                                expected: []string{"-varDir", "/k8up", "-restore", "-restoreType", "s3"}
                                actual  : []string{"-varDir", "", "-restore", "-restoreType", "s3"}

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -2,3 +2,3 @@
                                  (string) (len=7) "-varDir",
                                - (string) (len=5) "/k8up",
                                + (string) "",
                                  (string) (len=8) "-restore",
                Test:           TestRestore_args/givenS3RestoreResource_whenArgs_expectS3RestoreType
    --- FAIL: TestRestore_args/givenFolderRestoreResource_whenArgs_expectFolderRestoreType (0.00s)
        executor_test.go:255: 
                Error Trace:    /home/wejdross/vshn/shedar/k8up/operator/restorecontroller/executor_test.go:255
                Error:          Not equal: 
                                expected: []string{"-varDir", "/k8up", "-restore", "-restoreType", "folder"}
                                actual  : []string{"-varDir", "", "-restore", "-restoreType", "folder"}

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -2,3 +2,3 @@
                                  (string) (len=7) "-varDir",
                                - (string) (len=5) "/k8up",
                                + (string) "",
                                  (string) (len=8) "-restore",
                Test:           TestRestore_args/givenFolderRestoreResource_whenArgs_expectFolderRestoreType
    --- FAIL: TestRestore_args/givenFolderRestoreResourceWithAdditionalArguments_whenBuildRestoreObject_expectJobResource (0.00s)
        executor_test.go:255: 
                Error Trace:    /home/wejdross/vshn/shedar/k8up/operator/restorecontroller/executor_test.go:255
                Error:          Not equal: 
                                expected: []string{"-varDir", "/k8up", "-restore", "--tag", "testtag", "--tag", "another", "-restoreFilter", "testfilter", "-restoreSnap", "testsnapshot", "-restoreType", "folder"}
                                actual  : []string{"-varDir", "", "-restore", "--tag", "testtag", "--tag", "another", "-restoreFilter", "testfilter", "-restoreSnap", "testsnapshot", "-restoreType", "folder"}

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -2,3 +2,3 @@
                                  (string) (len=7) "-varDir",
                                - (string) (len=5) "/k8up",
                                + (string) "",
                                  (string) (len=8) "-restore",
                Test:           TestRestore_args/givenFolderRestoreResourceWithAdditionalArguments_whenBuildRestoreObject_expectJobResource
FAIL
coverage: 30.3% of statements

Huh, interesting. The CI Pipeline isn't running make test for some reason.

This specific test, checks the function setupArgs which hasn't been touched in a while.

I'm fixing it and adding make test to the CI tests :D

Kidswiss commented 2 months ago

@wejdross one of the tests had the wrong build tag, that's why it failed, it was actually an integration test.