test(e2e): E2E test improvements - #6804
Conversation
…ion from upstream
Argocd appsets use placeholder as a default target and ignore override of target. Kargo steps update target on argocd apps and use promotion for branch names. Also updated deprecated messageFromSteps to message with expressions. This allows rerunning the tests without noop steps.
Using e2e-framework tools set up a `kind` cluster, install `argocd` and `kargo` with helm charts and login using `argocd` and `kargo` CLI. See `README.md` and `kind_config.yaml` in `hack/test/e2e` for more information. Signed-off-by: Daniil Fedotov <daniil.fedotov@akuity.io>
✅ Deploy Preview for docs-kargo-io ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6804 +/- ##
==========================================
+ Coverage 30.84% 35.55% +4.70%
==========================================
Files 826 835 +9
Lines 80666 68613 -12053
==========================================
- Hits 24885 24394 -491
+ Misses 54327 44219 -10108
+ Partials 1454 0 -1454 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
e6df942 to
254d20c
Compare
|
Added remaining examples to suites.
|
Signed-off-by: Daniil Fedotov <daniil.fedotov@akuity.io>
Signed-off-by: Daniil Fedotov <daniil.fedotov@akuity.io>
| kargo_cli: | ||
| ## Indicate that we need to run `kargo login` to login into a kargo instance in `kind` cluster | ||
| kargo_login: | ||
| ## Uste tmp directory to store kargo config |
There was a problem hiding this comment.
Nit(spelling): s/Uste/Use
|
|
||
| fmt.Printf("Port forwarding %s to %d", service, outport) | ||
|
|
||
| p := utils.RunCommand(cmd) |
There was a problem hiding this comment.
Heads up that RunCommand is deprecated in favor of RunCommandContext. Also, does this reap the process on shutdown or does it stay hanging?
| loginConfig, ok := loginConfigVal.(map[string]any) | ||
| if ok { |
There was a problem hiding this comment.
Any reason we don't just make this extra config a concrete type? It would avoid a bunch of nesting and I don't think there are a ton of values. If this was being passed verbatim to something else to decode, I think it would be fine, but this seems fairly concrete
If we do keep it this way, one nit is that we can just invert the logic to avoid the huge nested block by doing:
if !ok {
return ctx, nil, nil
}There was a problem hiding this comment.
We could, but there's not much in that config at the moment to require that.
I'm trying to avoid typing the test config for now, since it's parsed into a map on the top level.
| return nil, err | ||
| } | ||
|
|
||
| func GetValueOrEnv(ctx context.Context, valueKey ContextKey, path []string) (any, error) { |
There was a problem hiding this comment.
Nit: I think this would be cleaner if the path argument was variadic (...string) as it would be cleaner to call
There was a problem hiding this comment.
I tried that, but it looks worse, since I can't read the "path" from there when I scan the code. Plus it makes optionalString signature look weird.
| "github.com/akuity/kargo/hack/test/e2e/envfuncs" | ||
| ) | ||
|
|
||
| func GetFuncs() ([]env.Func, []env.Func) { |
There was a problem hiding this comment.
I just noticed this now. Could you give a doc comment documenting which each slice of funcs is for?
| _ "github.com/akuity/kargo/pkg/gitprovider/azure" // Azure provider registration | ||
| _ "github.com/akuity/kargo/pkg/gitprovider/bitbucket/cloud" // Bitbucket Cloud provider registration | ||
| _ "github.com/akuity/kargo/pkg/gitprovider/gitea" // Gitea provider registration | ||
| _ "github.com/akuity/kargo/pkg/gitprovider/github" // GitHub provider registration | ||
| _ "github.com/akuity/kargo/pkg/gitprovider/gitlab" // GitLab provider registration |
There was a problem hiding this comment.
Nit: Just put a single comment over this saying this are for the provider registrations
Signed-off-by: Daniil Fedotov <daniil.fedotov@akuity.io>
Signed-off-by: Daniil Fedotov <daniil.fedotov@akuity.io>
More test suites
git-commitandgit-open-prfrom being skipped Not a production-compatible examples, but is good for testskindcluster with kargo and argocd installed.