diff --git a/cmd/juju/charmhub/doc.go b/cmd/juju/charmhub/doc.go
new file mode 100644
index 00000000000..c4e7e1e82b4
--- /dev/null
+++ b/cmd/juju/charmhub/doc.go
@@ -0,0 +1,6 @@
+// Copyright 2022 Canonical Ltd.
+// Licensed under the AGPLv3, see LICENCE file for details.
+
+// Package charmhub implements the Charmhub-related CLI commands, such as
+// "juju download", "juju find", and "juju info".
+package charmhub
diff --git a/cmd/juju/charmhub/infowriter.go b/cmd/juju/charmhub/infowriter.go
index c9941c9c88e..c343853b63f 100644
--- a/cmd/juju/charmhub/infowriter.go
+++ b/cmd/juju/charmhub/infowriter.go
@@ -107,13 +107,13 @@ func (iw infoWriter) writeClosedChannelToBuffer(w *UnicodeWriter, name string, h
type bundleInfoOutput struct {
Name string `yaml:"name,omitempty"`
- ID string `yaml:"bundle-id,omitempty"`
- Summary string `yaml:"summary,omitempty"`
Publisher string `yaml:"publisher,omitempty"`
+ Summary string `yaml:"summary,omitempty"`
+ Description string `yaml:"description,omitempty"`
+ StoreURL string `yaml:"store-url,omitempty"`
+ ID string `yaml:"bundle-id,omitempty"`
Supports string `yaml:"supports,omitempty"`
Tags string `yaml:"tags,omitempty"`
- StoreURL string `yaml:"store-url,omitempty"`
- Description string `yaml:"description,omitempty"`
Charms string `yaml:"charms,omitempty"`
Channels string `yaml:"channels,omitempty"`
Installed string `yaml:"installed,omitempty"`
@@ -138,14 +138,14 @@ func (b bundleInfoWriter) Print() error {
type charmInfoOutput struct {
Name string `yaml:"name,omitempty"`
- ID string `yaml:"charm-id,omitempty"`
- Summary string `yaml:"summary,omitempty"`
Publisher string `yaml:"publisher,omitempty"`
+ Summary string `yaml:"summary,omitempty"`
+ Description string `yaml:"description,omitempty"`
+ StoreURL string `yaml:"store-url,omitempty"`
+ ID string `yaml:"charm-id,omitempty"`
Supports string `yaml:"supports,omitempty"`
Tags string `yaml:"tags,omitempty"`
Subordinate bool `yaml:"subordinate"`
- StoreURL string `yaml:"store-url,omitempty"`
- Description string `yaml:"description,omitempty"`
Relations relationOutput `yaml:"relations,omitempty"`
Channels string `yaml:"channels,omitempty"`
Installed string `yaml:"installed,omitempty"`
diff --git a/cmd/juju/charmhub/infowriter_test.go b/cmd/juju/charmhub/infowriter_test.go
index 291514ed3d4..8b5302f7208 100644
--- a/cmd/juju/charmhub/infowriter_test.go
+++ b/cmd/juju/charmhub/infowriter_test.go
@@ -27,16 +27,16 @@ func (s *printInfoSuite) TestCharmPrintInfo(c *gc.C) {
obtained := ctx.Stdout.(*bytes.Buffer).String()
expected := `name: wordpress
-charm-id: charmCHARMcharmCHARMcharmCHARM01
-summary: WordPress is a full featured web blogging tool, this charm deploys it.
publisher: Wordress Charmers
-supports: bionic, xenial
-tags: app, seven
-subordinate: true
+summary: WordPress is a full featured web blogging tool, this charm deploys it.
description: |-
This will install and setup WordPress optimized to run in the cloud.
By default it will place Ngnix and php-fpm configured to scale horizontally with
Nginx's reverse proxy.
+charm-id: charmCHARMcharmCHARMcharmCHARM01
+supports: bionic, xenial
+tags: app, seven
+subordinate: true
relations:
provides:
one: two
@@ -61,16 +61,16 @@ func (s *printInfoSuite) TestCharmPrintInfoWithConfig(c *gc.C) {
obtained := ctx.Stdout.(*bytes.Buffer).String()
expected := `name: wordpress
-charm-id: charmCHARMcharmCHARMcharmCHARM01
-summary: WordPress is a full featured web blogging tool, this charm deploys it.
publisher: Wordress Charmers
-supports: bionic, xenial
-tags: app, seven
-subordinate: true
+summary: WordPress is a full featured web blogging tool, this charm deploys it.
description: |-
This will install and setup WordPress optimized to run in the cloud.
By default it will place Ngnix and php-fpm configured to scale horizontally with
Nginx's reverse proxy.
+charm-id: charmCHARMcharmCHARMcharmCHARM01
+supports: bionic, xenial
+tags: app, seven
+subordinate: true
relations:
provides:
one: two
@@ -149,11 +149,11 @@ func (s *printInfoSuite) TestBundlePrintInfo(c *gc.C) {
obtained := ctx.Stdout.(*bytes.Buffer).String()
expected := `name: osm
-bundle-id: bundleBUNDLEbundleBUNDLEbundle01
-summary: A bundle by charmed-osm.
publisher: charmed-osm
-tags: networking
+summary: A bundle by charmed-osm.
description: Single instance OSM bundle.
+bundle-id: bundleBUNDLEbundleBUNDLEbundle01
+tags: networking
channels: |
latest/stable: 1.0.3 2019-12-16 (16) 12MB
latest/candidate: 1.0.3 2019-12-16 (17) 12MB
diff --git a/state/charm_test.go b/state/charm_test.go
index c354b3f9548..75629b30918 100644
--- a/state/charm_test.go
+++ b/state/charm_test.go
@@ -815,10 +815,9 @@ actions:
`
func (s *CharmTestHelperSuite) TestActionsCharm(c *gc.C) {
- actions, err := charm.ReadActionsYaml("somecharm", bytes.NewBuffer([]byte(actionsYaml)))
- c.Assert(err, jc.ErrorIsNil)
-
forEachStandardCharm(c, func(name string) {
+ actions, err := charm.ReadActionsYaml(name, bytes.NewBuffer([]byte(actionsYaml)))
+ c.Assert(err, jc.ErrorIsNil)
ch := s.AddActionsCharm(c, name, actionsYaml, 123)
c.Assert(ch.Actions(), gc.DeepEquals, actions)
})
diff --git a/testcharms/charm-hub/bundles/juju-qa-bundle-test/README.md b/testcharms/charm-hub/bundles/juju-qa-bundle-test/README.md
index 9d7160039fd..a32fb987549 100644
--- a/testcharms/charm-hub/bundles/juju-qa-bundle-test/README.md
+++ b/testcharms/charm-hub/bundles/juju-qa-bundle-test/README.md
@@ -4,6 +4,10 @@
A bundle to use in testing juju.
+In the latest/stable channel:
+* Revision 2 has a default series of bionic, and uses focal too.
+* Revision 3 has a default series of jammy, and uses focal too.
+
## Usage
Basic deploy:
diff --git a/testcharms/charm-hub/bundles/juju-qa-bundle-test/bundle.yaml b/testcharms/charm-hub/bundles/juju-qa-bundle-test/bundle.yaml
index b22a3c35593..d917191d30e 100644
--- a/testcharms/charm-hub/bundles/juju-qa-bundle-test/bundle.yaml
+++ b/testcharms/charm-hub/bundles/juju-qa-bundle-test/bundle.yaml
@@ -1,74 +1,37 @@
name: juju-qa-bundle-test
-series: bionic
+series: jammy
applications:
- easyrsa:
- charm: containers-easyrsa
- channel: stable
- num_units: 1
- to:
- - lxd:0
- annotations:
- gui-x: "450"
- gui-y: "550"
- etcd:
- charm: etcd
- channel: stable
- num_units: 1
- to:
- - "0"
- options:
- channel: 3.2/stable
- annotations:
- gui-x: "800"
- gui-y: "550"
- flannel:
- charm: containers-flannel
- channel: stable
juju-qa-test:
charm: juju-qa-test
channel: 2.0/stable
- kubernetes-master:
- charm: containers-kubernetes-master
- channel: stable
num_units: 1
to:
- "0"
- expose: true
- options:
- channel: 1.12/stable
- kubernetes-worker:
- charm: containers-kubernetes-worker
- channel: stable
+ constraints: arch=amd64
+ juju-qa-test-focal:
+ charm: juju-qa-test
+ channel: latest/candidate
num_units: 1
+ series: focal
to:
- "1"
- expose: true
- options:
- channel: 1.12/stable
- proxy-extra-args: proxy-mode=userspace
+ constraints: arch=amd64
+ ntp:
+ charm: ntp
+ channel: stable
+ ntp-focal:
+ charm: ntp
+ channel: stable
+ series: focal
machines:
"0":
- constraints: arch=amd64 cores=2 mem=4G root-disk=16G
- series: bionic
+ constraints: arch=amd64
+ series: jammy
"1":
- constraints: arch=amd64 cores=4 mem=8G root-disk=20G
- series: bionic
+ constraints: arch=amd64
+ series: focal
relations:
-- - flannel:cni
- - kubernetes-worker:cni
-- - flannel:cni
- - kubernetes-master:cni
-- - kubernetes-worker:certificates
- - easyrsa:client
-- - etcd:certificates
- - easyrsa:client
-- - kubernetes-master:certificates
- - easyrsa:client
-- - kubernetes-master:kube-control
- - kubernetes-worker:kube-control
-- - kubernetes-master:kube-api-endpoint
- - kubernetes-worker:kube-api-endpoint
-- - flannel:etcd
- - etcd:db
-- - kubernetes-master:etcd
- - etcd:db
+- - ntp:juju-info
+ - juju-qa-test:juju-info
+- - ntp-focal:juju-info
+ - juju-qa-test-focal:juju-info
diff --git a/testcharms/charm-hub/bundles/juju-qa-bundle-test/charmcraft.yaml b/testcharms/charm-hub/bundles/juju-qa-bundle-test/charmcraft.yaml
index 60f2732c766..090d703551e 100644
--- a/testcharms/charm-hub/bundles/juju-qa-bundle-test/charmcraft.yaml
+++ b/testcharms/charm-hub/bundles/juju-qa-bundle-test/charmcraft.yaml
@@ -3,5 +3,5 @@ parts:
bundle:
prime: ["bundle.yaml", "README.md"]
charmhub:
- api_url: https://api.charmhub.io
- storage_url: https://storage.snapcraftcontent.com
+ api-url: https://api.charmhub.io
+ storage-url: https://storage.snapcraftcontent.com
diff --git a/testcharms/charm-repo/bionic/ubuntu-plus/actions.yaml b/testcharms/charms/ubuntu-plus/actions.yaml
similarity index 100%
rename from testcharms/charm-repo/bionic/ubuntu-plus/actions.yaml
rename to testcharms/charms/ubuntu-plus/actions.yaml
diff --git a/testcharms/charm-repo/bionic/ubuntu-plus/actions/dispatch b/testcharms/charms/ubuntu-plus/actions/dispatch
similarity index 100%
rename from testcharms/charm-repo/bionic/ubuntu-plus/actions/dispatch
rename to testcharms/charms/ubuntu-plus/actions/dispatch
diff --git a/testcharms/charm-repo/bionic/ubuntu-plus/actions/hello b/testcharms/charms/ubuntu-plus/actions/hello
similarity index 100%
rename from testcharms/charm-repo/bionic/ubuntu-plus/actions/hello
rename to testcharms/charms/ubuntu-plus/actions/hello
diff --git a/testcharms/charm-repo/bionic/ubuntu-plus/actions/no-dispatch b/testcharms/charms/ubuntu-plus/actions/no-dispatch
similarity index 100%
rename from testcharms/charm-repo/bionic/ubuntu-plus/actions/no-dispatch
rename to testcharms/charms/ubuntu-plus/actions/no-dispatch
diff --git a/testcharms/charm-repo/bionic/ubuntu-plus/actions/write-charm-state b/testcharms/charms/ubuntu-plus/actions/write-charm-state
similarity index 100%
rename from testcharms/charm-repo/bionic/ubuntu-plus/actions/write-charm-state
rename to testcharms/charms/ubuntu-plus/actions/write-charm-state
diff --git a/testcharms/charm-repo/bionic/ubuntu-plus/config.yaml b/testcharms/charms/ubuntu-plus/config.yaml
similarity index 100%
rename from testcharms/charm-repo/bionic/ubuntu-plus/config.yaml
rename to testcharms/charms/ubuntu-plus/config.yaml
diff --git a/testcharms/charm-repo/bionic/ubuntu-plus/dispatch b/testcharms/charms/ubuntu-plus/dispatch
similarity index 100%
rename from testcharms/charm-repo/bionic/ubuntu-plus/dispatch
rename to testcharms/charms/ubuntu-plus/dispatch
diff --git a/testcharms/charm-repo/bionic/ubuntu-plus/hooks/install b/testcharms/charms/ubuntu-plus/hooks/install
similarity index 100%
rename from testcharms/charm-repo/bionic/ubuntu-plus/hooks/install
rename to testcharms/charms/ubuntu-plus/hooks/install
diff --git a/testcharms/charm-repo/bionic/ubuntu-plus/hooks/update-status b/testcharms/charms/ubuntu-plus/hooks/update-status
similarity index 100%
rename from testcharms/charm-repo/bionic/ubuntu-plus/hooks/update-status
rename to testcharms/charms/ubuntu-plus/hooks/update-status
diff --git a/testcharms/charm-repo/bionic/ubuntu-plus/metadata.yaml b/testcharms/charms/ubuntu-plus/metadata.yaml
similarity index 94%
rename from testcharms/charm-repo/bionic/ubuntu-plus/metadata.yaml
rename to testcharms/charms/ubuntu-plus/metadata.yaml
index 8ee0dd20e51..61b08071b22 100644
--- a/testcharms/charm-repo/bionic/ubuntu-plus/metadata.yaml
+++ b/testcharms/charms/ubuntu-plus/metadata.yaml
@@ -7,4 +7,4 @@ series:
- focal
- bionic
- xenial
- - quantal
+ - jammy
diff --git a/testcharms/charm-repo/bionic/ubuntu-plus/revision b/testcharms/charms/ubuntu-plus/revision
similarity index 100%
rename from testcharms/charm-repo/bionic/ubuntu-plus/revision
rename to testcharms/charms/ubuntu-plus/revision
diff --git a/testcharms/charm-repo/bionic/ubuntu-plus/tools/write-charm-state b/testcharms/charms/ubuntu-plus/tools/write-charm-state
similarity index 100%
rename from testcharms/charm-repo/bionic/ubuntu-plus/tools/write-charm-state
rename to testcharms/charms/ubuntu-plus/tools/write-charm-state
diff --git a/testcharms/charm-repo/bionic/ubuntu-plus/version b/testcharms/charms/ubuntu-plus/version
similarity index 100%
rename from testcharms/charm-repo/bionic/ubuntu-plus/version
rename to testcharms/charms/ubuntu-plus/version
diff --git a/tests/suites/ck/ck.sh b/tests/suites/ck/ck.sh
index 74f95cb63d1..61c15dceaa4 100644
--- a/tests/suites/ck/ck.sh
+++ b/tests/suites/ck/ck.sh
@@ -29,6 +29,18 @@ run_deploy_ck() {
storage_path="./tests/suites/ck/storage/${BOOTSTRAP_PROVIDER}.yaml"
kubectl create -f "${storage_path}"
kubectl get sc -o yaml
+
+ # The model teardown could take too long time, so we decided to kill controller to speed up test run time.
+ # But this will not give the chance for integrator charm to do proper cleanup:
+ # - https://github.com/juju-solutions/charm-aws-integrator/blob/master/lib/charms/layer/aws.py#L616
+ # - especially the tag cleanup: https://github.com/juju-solutions/charm-aws-integrator/blob/master/lib/charms/layer/aws.py#L616
+ # This will leave the tags created by the integrater charm on subnets forever.
+ # And on AWS, the maximum number of tags per resource is 50.
+ # Then we will get `Error while granting requests (TagLimitExceeded); check credentials and debug-log` error in next test run.
+ # So we purge the subnet tags here in advance as a workaround.
+ integrator_app_name=$(cat "$overlay_path" | yq '.applications | keys | .[] | select(.== "*integrator")')
+ juju --show-log run-action "$integrator_app_name/leader" --wait=10m purge-subnet-tags
+ # juju --show-log run "$integrator_app_name/leader"--wait=10m purge-subnet-tags # 3.0
}
# Ensure that a CAAS workload (mariadb+mediawiki) deploys successfully,
diff --git a/tests/suites/hooks/dispatch.sh b/tests/suites/hooks/dispatch.sh
index 661f3e84eac..e2338862c5b 100644
--- a/tests/suites/hooks/dispatch.sh
+++ b/tests/suites/hooks/dispatch.sh
@@ -10,9 +10,7 @@ run_hook_dispatching_script() {
# log level is WARNING.
juju model-config logging-config="=INFO"
- # TODO - upgrade the charm to support focal
- juju deploy juju-qa-ubuntu-plus --channel=beta --series focal --force
-
+ juju deploy ./testcharms/charms/ubuntu-plus
wait_for "ubuntu-plus" "$(idle_condition "ubuntu-plus")"
juju debug-log --include unit-ubuntu-plus-0 | grep -q "via hook dispatching script: dispatch" || true
diff --git a/tests/suites/model/migration.sh b/tests/suites/model/migration.sh
index 2ea6cd0f1f3..175ff75a271 100644
--- a/tests/suites/model/migration.sh
+++ b/tests/suites/model/migration.sh
@@ -54,6 +54,9 @@ run_model_migration() {
# - Migrates from stable -> devel controller
# - Asserts the deployed application continues to work
run_model_migration_version() {
+ # Record the current value then restore later once this run done.
+ SHORT_GIT_COMMIT_VALUE="$SHORT_GIT_COMMIT"
+ JUJU_VERSION_VALUE="$JUJU_VERSION"
# Reset JUJU_VERSION and SHORT_GIT_COMMIT for stable bootstrap
unset SHORT_GIT_COMMIT
juju_version_without_build_number=$(echo "$JUJU_VERSION" | sed "s/.$JUJU_BUILD_NUMBER//")
@@ -73,8 +76,6 @@ run_model_migration_version() {
fi
export JUJU_VERSION=$stable_version
- # Unset to re-generate from the new agent-version.
- unset BOOTSTRAP_ADDITIONAL_ARGS
# Ensure we have another controller available.
bootstrap_alt_controller "alt-model-migration-version-stable"
juju --show-log switch "alt-model-migration-version-stable"
@@ -127,13 +128,17 @@ run_model_migration_version() {
wait_for "active" "$(workload_status "etcd" 3).current"
wait_for "active" "$(workload_status "etcd" 4).current"
- # juju --show-log run etcd/0 etcd/1 etcd/2 etcd/3 etcd/4 --wait=50m health # 3.0
- juju --show-log run-action etcd/0 etcd/1 etcd/2 etcd/3 etcd/4 --wait=50m health # 2.9
+ # juju --show-log run etcd/0 etcd/1 etcd/2 etcd/3 etcd/4 --wait=10m health # 3.0
+ juju --show-log run-action etcd/0 etcd/1 etcd/2 etcd/3 etcd/4 --wait=10m health # 2.9
# Clean up.
destroy_controller "alt-model-migration-version-stable"
destroy_model "model-migration-version-stable"
+
+ # Restore these two environment variables for the rest of the tests.
+ export SHORT_GIT_COMMIT="$SHORT_GIT_COMMIT_VALUE"
+ export JUJU_VERSION="$JUJU_VERSION_VALUE"
}
# Migrating a model that is the offerer of a cross-model relation
@@ -161,13 +166,19 @@ run_model_migration_saas_common() {
wait_for "dummy-sink" "$(idle_condition "dummy-sink")"
- juju consume "${BOOTSTRAPPED_JUJU_CTRL_NAME}:admin/model-migration-saas.dummy-source"
- juju relate dummy-sink dummy-source
+ juju --show-log consume "${BOOTSTRAPPED_JUJU_CTRL_NAME}:admin/model-migration-saas.dummy-source"
+ juju --show-log relate dummy-sink dummy-source
+ # wait for relation joined before migrate.
+ # work around for fixing:
+ # ERROR source prechecks failed: unit dummy-source/0 hasn't joined relation "dummy-source:sink remote-abaa4396b3ae409981ad83d1d04af21f:source" yet
+ wait_for "dummy-source" '.applications["dummy-sink"] | .relations.source[0]'
+ sleep 30
juju switch "model-migration-saas"
wait_for "1" '.offers["dummy-source"]["active-connected-count"]'
- juju migrate "model-migration-saas" "alt-model-migration-saas"
+ juju --show-log migrate "model-migration-saas" "alt-model-migration-saas"
+ sleep 5
juju switch "alt-model-migration-saas"
# Wait for the new model migration to appear in the alt controller.
@@ -224,13 +235,17 @@ run_model_migration_saas_external() {
wait_for "dummy-sink" "$(idle_condition "dummy-sink")"
- juju consume "${BOOTSTRAPPED_JUJU_CTRL_NAME}:admin/model-migration-saas.dummy-source"
- juju relate dummy-sink dummy-source
+ juju --show-log consume "${BOOTSTRAPPED_JUJU_CTRL_NAME}:admin/model-migration-saas.dummy-source"
+ juju --show-log relate dummy-sink dummy-source
+ # wait for relation joined before migrate.
+ wait_for "dummy-source" '.applications["dummy-sink"] | .relations.source[0]'
+ sleep 30
juju switch "${BOOTSTRAPPED_JUJU_CTRL_NAME}"
wait_for "1" '.offers["dummy-source"]["active-connected-count"]'
- juju migrate "model-migration-saas" "model-migration-saas-target"
+ juju --show-log migrate "model-migration-saas" "model-migration-saas-target"
+ sleep 5
juju switch "model-migration-saas-target"
# Wait for the new model migration to appear in the target controller.
@@ -288,15 +303,19 @@ run_model_migration_saas_consumer() {
wait_for "dummy-sink" "$(idle_condition "dummy-sink")"
- juju consume "${BOOTSTRAPPED_JUJU_CTRL_NAME}:admin/model-migration-saas.dummy-source"
- juju relate dummy-sink dummy-source
+ juju --show-log consume "${BOOTSTRAPPED_JUJU_CTRL_NAME}:admin/model-migration-saas.dummy-source"
+ juju --show-log relate dummy-sink dummy-source
+ # wait for relation joined before migrate.
+ wait_for "dummy-source" '.applications["dummy-sink"] | .relations.source[0]'
+ sleep 30
juju switch "${BOOTSTRAPPED_JUJU_CTRL_NAME}"
juju config dummy-source token=wait-for-it
juju switch "model-migration-saas-consume"
wait_for "wait-for-it" "$(workload_status "dummy-sink" 0).message"
- juju migrate "model-migration-consumer" "model-migration-saas-target"
+ juju --show-log migrate "model-migration-consumer" "model-migration-saas-target"
+ sleep 5
juju switch "model-migration-saas-target"
# Wait for the new model migration to appear in the target controller.
@@ -355,6 +374,9 @@ bootstrap_alt_controller() {
START_TIME=$(date +%s)
echo "====> Bootstrapping ${name}"
+ # Unset to re-generate from the new agent-version.
+ unset BOOTSTRAP_ADDITIONAL_ARGS
+
file="${TEST_DIR}/${name}.log"
juju_bootstrap "${BOOTSTRAP_CLOUD}" "${name}" "misc" "${file}"