-
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(testing): add spread testing template files #1514
feat(testing): add spread testing template files #1514
Conversation
Add Jinja2 template files for machine charm testing, installed when initializing a minimal charm with `charmcraft init --profile machine`. Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
cmd = f"{os.environ['SNAP']}/bin/spread" | ||
with emit.pause(): | ||
subprocess.run([cmd, "-v", *self.arguments], check=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.
This is experimental code. This must be better handled before reaching production.
This first iteration runs spread in verbose mode. Output example:
|
30620c9
to
9d75ee3
Compare
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
9d75ee3
to
2bf8b8d
Compare
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 (with the caveat that this is on a feature branch and only adds the test files to the machine charm template)
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 good! I've got a few minor things but I'm happy with the overall structure.
users: | ||
- default | ||
- name: spread | ||
plain_text_passwd: 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.
Is there a way to do this using spread's generated passwords?
If you don't have a simple way to do it immediately, please make an issue so we don't forget about it - I don't want spread/spread
to become one of the username/password pairs bad guys start scanning cloud services with :-)
@@ -0,0 +1,32 @@ | |||
|
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.
Probably worth a comment up here explaining what these functions are used for.
CHARMCRAFT_CHANNEL/alt1,alt3: latest/stable | ||
CHARMCRAFT_CHANNEL/alt2: latest/candidate | ||
|
||
# This creates 3 test variants: |
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 might make more sense above environment
?
install_lxd | ||
snap install charmcraft --classic --channel "$CHARMCRAFT_CHANNEL" | ||
snap install juju --classic --channel "$JUJU_CHANNEL" | ||
mkdir -p "$HOME"/.local/share/juju | ||
|
||
bootstrap_juju |
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.
Shouldn't we be doing this once per runner in spread.yaml
?
@@ -64,6 +64,9 @@ apps: | |||
# same for config | |||
XDG_CONFIG_HOME: $SNAP_USER_COMMON/config | |||
|
|||
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.
I'd rather not have a separate charmcraft.spread
application for now.
def run(self, parsed_args: argparse.Namespace): | ||
"""Execute command's actual functionality.""" | ||
try: | ||
cmd = f"{os.environ['SNAP']}/bin/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.
cmd = f"{os.environ['SNAP']}/bin/spread" | |
# TODO: Make this work without Charmcraft being snapped | |
cmd = f"{os.environ['SNAP']}/bin/spread" |
Thinking of our users on macos :-)
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
a51ebd8
to
6f84191
Compare
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
568ee53
to
999cb05
Compare
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
7e01e99
to
9153264
Compare
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
Add Jinja2 template files for machine charm testing, installed when
initializing a minimal charm with
charmcraft init --profile machine
.Signed-off-by: Claudio Matsuoka claudio.matsuoka@canonical.com