-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14573 from anvial/JUJU-1307-rewrite-to-bash-based…
…-nw-resolve #14573 This PR added a bash-based version of the `nw-resolve` test to the deploy suite. To implement the test, the `simple-resolve` charm was copied to the `testcharms` subfolder. ## Checklist - [ ] Code style: imports ordered, good names, simple structure, etc - [ ] Comments saying why design decisions were made ## QA steps ```sh cd tests ./main.sh -v -p lxd deploy run_resolve_charm ```
- Loading branch information
Showing
6 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Simple charm that errors once on the install hook, but works the next time run. | ||
|
||
Used to test juju resolve command. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Copyright 2018 Canonical Ltd. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
# Simple install hook that errors the first time it is run, on any subsequent | ||
# run the hook will succeed (unless the canary file is removed). | ||
|
||
canary_file=/tmp/resolver.canary | ||
success_file=/tmp/resolver.success | ||
|
||
function exit_error() { | ||
status-set blocked "Install hook failed on: $1 attempts." || true | ||
exit 1 | ||
} | ||
|
||
if [ ! -e ${canary_file} ]; then | ||
echo "No canary file, exiting error." | ||
echo 1 > ${canary_file} | ||
exit_error 1 | ||
fi | ||
|
||
# Need to error for x amount of times before juju stops trying automatically. | ||
run_count=$(cat ${canary_file}) | ||
|
||
# For now juju is always re-trying. Need to just exit regardless. | ||
echo $((${run_count}+1)) > ${canary_file} | ||
exit_error ${run_count} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
install_success_file=/tmp/resolver.success | ||
|
||
status_message="No install hook" | ||
if [ -e ${install_success_file} ]; then | ||
status_message="Install hook succeeded" | ||
fi | ||
|
||
echo "${status_message}" | ||
status-set active "${status_message}" || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: simple-resolve | ||
maintainer: Christopher Lee <chris.mclachlan-lee@canonical.com> | ||
summary: Purposfully error on install hook for testing resolve command. | ||
description: | | ||
A testing charm that errors once on install hook then succeeds on the next run. | ||
categories: | ||
- misc | ||
series: | ||
- jammy | ||
- focal | ||
- bionic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters