Skip to content

Commit

Permalink
Merge pull request juju#18151 from barrettj12/pack-testcharms
Browse files Browse the repository at this point in the history
juju#18151

Deploying a charm from an unpacked directory is no longer supported in 4.0. Hence, when using local charms in testing, we need to pack them first inside the test.
- I added a test utility function `pack_charm` which uses Charmcraft to pack the charm at the given path, and returns a glob that can be provided to `juju deploy` to deploy the packed charm.
- I have added/updated the `charmcraft.yaml` in several testing charms to be compatible with the new [Charmcraft changes in 3.0](https://discourse.charmhub.io/t/charmcraft-3-0-in-the-beta-channel/13469).
- I have added `charmcraft` to the checked dependencies for those tests which require charms to be packed.

## Checklist

<!-- If an item is not applicable, use `~strikethrough~`. -->

- [x] Code style: imports ordered, good names, simple structure, etc
- [x] Comments saying why design decisions were made
- ~[ ] Go unit tests, with comments saying what you're testing~
- [x] [Integration tests](https://github.com/juju/juju/tree/main/tests), with comments saying what you're testing
- ~[ ] [doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages~

## QA steps

<!-- Describe steps to verify that the change works. -->

Run the following test suites: deploy, hooks, relations, sidecar, spaces_ec2, storage.

Many of these tests will not pass due to other issues, but at least we should not see the following error:
```
ERROR attempting to deploy "....": deploying from directory not supported
```

## Links

**Jira card:** JUJU-6825
  • Loading branch information
jujubot authored Oct 15, 2024
2 parents f72cdcd + ded0fe2 commit 8022334
Show file tree
Hide file tree
Showing 35 changed files with 289 additions and 187 deletions.
3 changes: 2 additions & 1 deletion testcharms/charms/appdata-sink/charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ bases:
- arm64
- s390x
parts:
tiny-bash:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
Expand Down
3 changes: 2 additions & 1 deletion testcharms/charms/appdata-source/charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ bases:
- arm64
- s390x
parts:
tiny-bash:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
Expand Down
21 changes: 12 additions & 9 deletions testcharms/charms/departer/charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Learn more about charmcraft.yaml configuration at:
# https://juju.is/docs/sdk/charmcraft-config
type: "charm"
bases:
- build-on:
- name: "ubuntu"
channel: "22.04"
run-on:
- name: "ubuntu"
channel: "22.04"
base: [email protected]
platforms:
amd64:
arm64:
s390x:
parts:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
- hooks
43 changes: 8 additions & 35 deletions testcharms/charms/dummy-sink/charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,12 @@
type: "charm"
bases:
- build-on:
- name: "ubuntu"
channel: "20.04"
architectures: ["amd64", "arm64"]
run-on:
- name: "ubuntu"
channel: "16.04"
architectures:
- amd64
- aarch64
- arm64
- s390x
- name: "ubuntu"
channel: "18.04"
architectures:
- amd64
- aarch64
- arm64
- s390x
- name: "ubuntu"
channel: "20.04"
architectures:
- amd64
- aarch64
- arm64
- s390x
- name: "ubuntu"
channel: "22.04"
architectures:
- amd64
- aarch64
- arm64
- s390x
base: [email protected]
platforms:
amd64:
arm64:
s390x:
parts:
tiny-bash:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
Expand All @@ -45,3 +17,4 @@ parts:
- copyright
- hooks
- metadata.yaml
- scripts
42 changes: 7 additions & 35 deletions testcharms/charms/dummy-source/charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,12 @@
type: "charm"
bases:
- build-on:
- name: "ubuntu"
channel: "20.04"
architectures: ["amd64", "arm64"]
run-on:
- name: "ubuntu"
channel: "16.04"
architectures:
- amd64
- aarch64
- arm64
- s390x
- name: "ubuntu"
channel: "18.04"
architectures:
- amd64
- aarch64
- arm64
- s390x
- name: "ubuntu"
channel: "20.04"
architectures:
- amd64
- aarch64
- arm64
- s390x
- name: "ubuntu"
channel: "22.04"
architectures:
- amd64
- aarch64
- arm64
- s390x
base: [email protected]
platforms:
amd64:
arm64:
s390x:
parts:
tiny-bash:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
Expand Down
13 changes: 13 additions & 0 deletions testcharms/charms/dummy-storage-fs/charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type: "charm"
base: [email protected]
platforms:
amd64:
arm64:
s390x:
parts:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
- hooks
13 changes: 13 additions & 0 deletions testcharms/charms/dummy-storage-lp/charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type: "charm"
base: [email protected]
platforms:
amd64:
arm64:
s390x:
parts:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
- hooks
13 changes: 13 additions & 0 deletions testcharms/charms/dummy-storage-mp/charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type: "charm"
base: [email protected]
platforms:
amd64:
arm64:
s390x:
parts:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
- hooks
13 changes: 13 additions & 0 deletions testcharms/charms/dummy-storage-np/charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type: "charm"
base: [email protected]
platforms:
amd64:
arm64:
s390x:
parts:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
- hooks
13 changes: 13 additions & 0 deletions testcharms/charms/dummy-storage-tp/charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type: "charm"
base: [email protected]
platforms:
amd64:
arm64:
s390x:
parts:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
- hooks
13 changes: 13 additions & 0 deletions testcharms/charms/dummy-storage/charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type: "charm"
base: [email protected]
platforms:
amd64:
arm64:
s390x:
parts:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
- hooks
42 changes: 7 additions & 35 deletions testcharms/charms/lxd-profile-subordinate/charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,12 @@
type: "charm"
bases:
- build-on:
- name: "ubuntu"
channel: "20.04"
architectures: ["amd64", "arm64"]
run-on:
- name: "ubuntu"
channel: "22.04"
architectures:
- amd64
- aarch64
- arm64
- s390x
- name: "ubuntu"
channel: "20.04"
architectures:
- amd64
- aarch64
- arm64
- s390x
- name: "ubuntu"
channel: "18.04"
architectures:
- amd64
- aarch64
- arm64
- s390x
- name: "ubuntu"
channel: "16.04"
architectures:
- amd64
- aarch64
- arm64
- s390x
base: [email protected]
platforms:
amd64:
arm64:
s390x:
parts:
tiny-bash:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ bases:
- arm64
- s390x
parts:
tiny-bash:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
Expand Down
43 changes: 7 additions & 36 deletions testcharms/charms/lxd-profile/charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,16 @@
type: "charm"
bases:
- build-on:
- name: "ubuntu"
channel: "20.04"
architectures: ["amd64", "arm64"]
run-on:
- name: "ubuntu"
channel: "22.04"
architectures:
- amd64
- aarch64
- arm64
- s390x
- name: "ubuntu"
channel: "20.04"
architectures:
- amd64
- aarch64
- arm64
- s390x
- name: "ubuntu"
channel: 18.04"
architectures:
- amd64
- aarch64
- arm64
- s390x
- name: "ubuntu"
channel: "16.04"
architectures:
- amd64
- aarch64
- arm64
- s390x
base: [email protected]
platforms:
amd64:
arm64:
s390x:
parts:
tiny-bash:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
- README.md
- config.yaml
- hooks
- icon.svg
- lxd-profile.yaml
Expand Down
13 changes: 13 additions & 0 deletions testcharms/charms/sidecar-non-root/charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type: "charm"
base: [email protected]
platforms:
amd64:
arm64:
s390x:
parts:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
- hooks
13 changes: 13 additions & 0 deletions testcharms/charms/sidecar-sudoer/charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type: "charm"
base: [email protected]
platforms:
amd64:
arm64:
s390x:
parts:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
- hooks
13 changes: 13 additions & 0 deletions testcharms/charms/simple-resolve/charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type: "charm"
base: [email protected]
platforms:
amd64:
arm64:
s390x:
parts:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
- hooks
14 changes: 14 additions & 0 deletions testcharms/charms/space-defender/charmcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
type: "charm"
base: [email protected]
platforms:
amd64:
arm64:
s390x:
parts:
# Include extra files in the packed charm
include:
plugin: dump
source: .
prime:
- hooks
- revision
Loading

0 comments on commit 8022334

Please sign in to comment.