Skip to content

Commit

Permalink
Merge pull request juju#18385 from Aflynn50/fix-local-charms-test-2
Browse files Browse the repository at this point in the history
juju#18385

Backport juju#18216 from 3.6.

> Git needed to have a user to commit, set the user.
  • Loading branch information
jujubot authored Nov 19, 2024
2 parents 53f919a + 24c32f7 commit 1d21840
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tests/suites/cli/local_charms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ run_deploy_local_charm_revision() {
cd "${TMP}/ubuntu-plus" || exit 1

# Initialise a git repo to check the commit SHA is used as the charm version.
git init
git add . && git commit -m "commit everything"
create_local_git_and_commit_all
SHA_OF_UBUNTU_PLUS=\"$(git describe --dirty --always)\"

# Deploy from directory.
Expand Down Expand Up @@ -100,8 +99,7 @@ run_deploy_local_charm_revision_relative_path() {
cd "${TMP}/ubuntu-plus" || exit 1

# Initialise a git repo and commit everything so that commit SHA is used as the charm version.
git init
git add . && git commit -m "commit everything"
create_local_git_and_commit_all
SHA_OF_UBUNTU_PLUS=\"$(git describe --dirty --always)\"

# Create git directory outside the charm directory
Expand Down Expand Up @@ -149,8 +147,7 @@ run_deploy_local_charm_revision_invalid_git() {
cd "${TMP_CHARM_GIT}/ubuntu-plus" || exit 1

# Initialise a git repo and commit everything so that commit SHA is used as the charm version.
git init
git add . && git commit -m "commit everything"
create_local_git_and_commit_all
SHA_OF_UBUNTU_PLUS=\"$(git describe --dirty --always)\"

WANTED_CHARM_SHA=\"$(git describe --dirty --always)\"
Expand Down Expand Up @@ -183,6 +180,15 @@ create_local_git_folder() {
git commit -am "rand_file"
}

create_local_git_and_commit_all() {
git init .
if [ -z "$(git config --global user.email)" ]; then
git config --global user.email "[email protected]"
git config --global user.name "John Doe"
fi
git add . && git commit -m "commit everything"
}

test_local_charms() {
if [ "$(skip 'test_local_charms')" ]; then
echo "==> TEST SKIPPED: deploy local charm tests"
Expand Down

0 comments on commit 1d21840

Please sign in to comment.