-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Initial E2E framework and simple tests #211
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, very nice, thanks @jopit! I added some minor comments I noticed while reading through the code, let me know what you think.
I had a couple of questions but they are more general project questions for everyone, so I will loop in Jann et al.
One other question from me:
Any changes in 'argocd-agent/test/e2e2' that you would suggest we may want to port back to 'argocd-agent/hack/demo-env'?
- For example, extra timeout logic in 'setup-vcluster-env.sh' looked useful for both
- Removal of
.data
from Secrets defined inargocd-secret.yaml
setup-e2e2: | ||
test/e2e2/test-env/setup-vcluster-env.sh create | ||
|
||
.PHONY: start-argocd-agent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: the Makefile
target of start-argocd-agent
. Rather than start-argocd-agent
, which might imply this would start Argo agent for development purposes (similar to make start
from Argo CD), WDYT about:
start-argocd-agent-for-e2e
(maybe too long?)start-e2e
/start-e2e2
(shorter, this is what we use in argo cd, and in rollouts operator)- Other options?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Changed it to start-e2e2
"k8s.io/client-go/restmapper" | ||
) | ||
|
||
type KubeObject interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could add a comment here for KubeObject
and KubeObjectList
indicating these are similar to Object
and ObjectList
from controller-runtime, or even more generally that this package aims to provide a similar style interface to controller-runtime (which we are avoiding adding a dependency on here).
IMHO this might be useful comment to add (and presuming my assumption is true), but it's up to you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
err := suite.ManagedAgentClient.Get(suite.Ctx, key, &app, metav1.GetOptions{}) | ||
return err == nil | ||
}, 30*time.Second, 1*time.Second) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we check that the content (.spec
field) is the same between the managed-agent and principal, as well? It's very likely, but it can't hurt to check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
return err == nil | ||
}, 30*time.Second, 1*time.Second) | ||
|
||
// Delete the app from the principal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if you think this is scope creep from the original requirements, but before we delete the Application in the next step, can we test the update case, as well?
E.g. just making a small change to one of the fields of the Application on principal, and making sure it percolates down to managed-agent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
// Delete the app from the autonomous-agent | ||
err = suite.AutonomousAgentClient.Delete(suite.Ctx, &app, metav1.DeleteOptions{}) | ||
requires.NoError(err) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, can be useful to check .spec
is in sync, and to test the update case before deleting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
err := suite.ManagedAgentClient.Get(suite.Ctx, key, &app, metav1.GetOptions{}) | ||
return err == nil | ||
}, 30*time.Second, 1*time.Second) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned elsewhere, can be useful to verify that the .Spec
fields are the same in both places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
err := suite.PrincipalClient.Get(suite.Ctx, principalKey, &app, metav1.GetOptions{}) | ||
return err == nil | ||
}, 30*time.Second, 1*time.Second) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, couldn't hurt to verify .spec
s are the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
exit 1 | ||
fi | ||
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" | ||
test -f cmd/agent/main.go || (echo "Script should be run from argocd-agent's root path" >&2; exit 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than testing that the script is run from the correct place, would it be preferable to just add cd $SCRIPTPATH/../../..
before go run
to ensure that this is always true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved this by making the same changes that Jann made to the demo-env scripts to allow running from anywhere in the repo tree, PR #193
exit 1 | ||
fi | ||
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" | ||
test -f cmd/agent/main.go || (echo "Script should be run from argocd-agent's root path" >&2; exit 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as automonous above, can use SCRIPTPATH if it makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved this by making the same changes that Jann made to the demo-env scripts to allow running from anywhere in the repo tree, PR #193
exit 1 | ||
fi | ||
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" | ||
test -f cmd/principal/main.go || (echo "Script should be run from argocd-agent's root path" >&2; exit 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as autonomous above, can use SCRIPTPATH if it makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved this by making the same changes that Jann made to the demo-env scripts to allow running from anywhere in the repo tree, PR #193
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #211 +/- ##
==========================================
- Coverage 46.89% 46.83% -0.06%
==========================================
Files 57 57
Lines 4956 4951 -5
==========================================
- Hits 2324 2319 -5
Misses 2451 2451
Partials 181 181 ☔ View full report in Codecov by Sentry. |
f4f1592
to
f70c232
Compare
Signed-off-by: John Pitman <[email protected]>
Signed-off-by: John Pitman <[email protected]>
Signed-off-by: John Pitman <[email protected]>
b08036b
to
7c34544
Compare
Signed-off-by: John Pitman <[email protected]>
7c34544
to
5bd3dca
Compare
Initial E2E framework and simple tests
Resolves issue #137