-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify the checks and include an iface check
- Loading branch information
1 parent
65637cb
commit 060d743
Showing
8 changed files
with
47 additions
and
24 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 |
---|---|---|
@@ -1,19 +1,17 @@ | ||
# Import other goss.yaml files | ||
gossfile: | ||
goss_az_checks.yaml: {} | ||
goss_k8s_checks.yaml: {} | ||
goss_model_checks.yaml: {} | ||
goss_network_checks.yaml: {} | ||
goss_pebble_checks.yaml: {} | ||
goss_complex_checks.yaml: {} | ||
# goss_k8s_checks.yaml: {} | ||
# goss_model_checks.yaml: {} | ||
# goss_network_checks.yaml: {} | ||
# goss_pebble_checks.yaml: {} | ||
|
||
command: | ||
# Grafana post-relation checks | ||
{{ if .Vars.enable_post_relation_tests }} | ||
grafana-related-dashboards: | ||
exec: bash goss/scripts/compare-dashboard-uids.sh {{ .Vars.model_name }} {{ .Vars.apps.k8s.grafana.name }} {{ .Vars.apps.k8s.alertmanager.name }} | ||
exit-status: 0 | ||
stdout: | ||
have-patterns: | ||
- "Match found." | ||
stderr: "" | ||
{{ end }} |
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
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
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
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
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
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,29 @@ | ||
#!/bin/sh | ||
|
||
# For all charms in $model_name that have the $expected_relation:$expected_interface, check if they are related to the $expected_related_charm | ||
|
||
model_name="$1" | ||
expected_related_charm="$2" | ||
expected_relation="$3" | ||
expected_interface="$4" | ||
|
||
for charm in $(juju status -m "$model_name" --format=json | jq -r '.applications | keys[]'); do | ||
metadata_yaml=$(juju ssh -m "$model_name" ${charm}/0 "cat agents/unit-${charm}-0/charm/metadata.yaml") | ||
|
||
# Extract interface information | ||
interface_requires=$(echo "$metadata_yaml" | yq '.requires | .'$expected_relation'.interface') | ||
interface_provides=$(echo "$metadata_yaml" | yq '.provides | .'$expected_relation'.interface') | ||
|
||
# Check if interfaces match the expected one | ||
if [[ "$interface_requires" == "$expected_interface" || "$interface_provides" == "$expected_interface" ]]; then | ||
is_charm_related=$(juju status -m "$model_name" --format=json | jq -r '[.applications.'$expected_related_charm'.relations[] | map(select(.["related-application"] == "'$charm'"))] | add | length > 0') | ||
if [[ "$is_charm_related" == "true" ]]; then | ||
echo "INFO: $charm is related to $expected_related_charm via interface: $expected_relation:$expected_interface" | ||
else | ||
echo "ERROR: $charm is NOT related to $expected_related_charm" | ||
fi | ||
else | ||
echo "INFO: $charm does not have the expected interface: $expected_relation:$expected_interface" | ||
fi | ||
done | ||
|
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