-
Notifications
You must be signed in to change notification settings - Fork 73
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: add test command and templates #1660
feat: add test command and templates #1660
Conversation
f07efab
to
c6df503
Compare
The `charmcraft test` command invokes spread to run test suites on local and remote machines. A pre-defined spread configuration and multipass back-end are supplied. Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
c6df503
to
eb6213a
Compare
Rebased on main. |
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
eb6213a
to
cfda0e4
Compare
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
7efba0b
to
0d5c2a0
Compare
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
0d5c2a0
to
6b1bb65
Compare
# arguments. We should implement better support for this case | ||
# in craft-application. | ||
idx = sys.argv.index("test") + 1 | ||
sys.argv = [*sys.argv[:idx], "--", *sys.argv[idx:]] |
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.
This is still going to be a little bit weird because charmcraft test
will take arguments like -shell
rather than --shell
. Can you think of a downside of stripping --
off the start of test parameters and replacing it with -
?
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.
The --
separator is actually parsed by argparse to make it ignore any argument after that (so we can pass it directly to spread). The -
vs --
inconsistency is an issue however, we can discuss that further and maybe go back to using --
as an explicit separator.
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.
Yeah, especially with the way this obscures the help text. I think long-term we'll probably need to make our own items for common parameters and then let the user pass -- <spread-params>
if they want to do anything fancy with spread.
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.
Looking good!
charmcraft/templates/init-simple/tests/spread/lib/tools/retry.j2
Outdated
Show resolved
Hide resolved
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
Also don't run the github back-end locally. Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
…r-charmcraft-test
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.
Nice work!
Do you need charmcraft/templates/init-machine/tests/spread/lib/tools/retry.j2
?
The
charmcraft test
command invokes spread to run test suites onlocal and remote machines. A pre-defined spread configuration and
multipass back-end are supplied.
Signed-off-by: Claudio Matsuoka claudio.matsuoka@canonical.com