github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/tests/suites/deploy/os.sh (about)

     1  test_deploy_os() {
     2  	if [ "$(skip 'test_deploy_os')" ]; then
     3  		echo "==> TEST SKIPPED: deploy to os"
     4  		return
     5  	fi
     6  
     7  	(
     8  		set_verbosity
     9  
    10  		cd .. || exit
    11  
    12  		case "${BOOTSTRAP_PROVIDER:-}" in
    13  		"ec2" | "aws")
    14  			#
    15  			# A handy place to find the current AMIs for centos
    16  			# https://wiki.centos.org/Cloud/AWS
    17  			#
    18  			run "run_deploy_centos7"
    19  			run "run_deploy_centos9"
    20  			;;
    21  		*)
    22  			echo "==> TEST SKIPPED: deploy_centos - tests for AWS only"
    23  			;;
    24  		esac
    25  	)
    26  }
    27  
    28  run_deploy_centos7() {
    29  	echo
    30  
    31  	echo "==> Checking for dependencies"
    32  	check_juju_dependencies metadata
    33  
    34  	name="test-deploy-centos7"
    35  	file="${TEST_DIR}/${name}.log"
    36  
    37  	ensure "${name}" "${file}"
    38  
    39  	#
    40  	# Images have been setup and and subscribed for juju-qa aws
    41  	# in us-west-2.  Take care editing the details.
    42  	#
    43  	juju add-model test-deploy-centos-west2 aws/us-west-2
    44  
    45  	juju metadata add-image --base centos@7 ami-0bc06212a56393ee1
    46  
    47  	#
    48  	# There is a specific list of instance types which can be used with
    49  	# this image.  Sometimes juju chooses the wrong one e.g. t3a.medium.
    50  	# Ensure we use one that is allowed.
    51  	#
    52  	juju deploy ./tests/suites/deploy/charms/centos-dummy-sink --base centos@7 --constraints instance-type=t3.medium
    53  
    54  	juju status --format=json | jq '.applications."dummy-sink".base.name' | check "centos"
    55  	juju status --format=json | jq '.applications."dummy-sink".base.channel' | check "7"
    56  
    57  	wait_for "dummy-sink" "$(idle_condition "dummy-sink")"
    58  
    59  	destroy_model "${name}"
    60  	destroy_model "test-deploy-centos-west2"
    61  }
    62  
    63  run_deploy_centos9() {
    64  	echo
    65  
    66  	echo "==> Checking for dependencies"
    67  	check_juju_dependencies metadata
    68  
    69  	name="test-deploy-centos9"
    70  	file="${TEST_DIR}/${name}.log"
    71  
    72  	ensure "${name}" "${file}"
    73  
    74  	#
    75  	# Images have been setup and and subscribed for juju-qa aws
    76  	# in us-east-1.  Take care editing the details.
    77  	#
    78  	juju metadata add-image --base centos@9 ami-0df2a11dd1fe1f8e3
    79  
    80  	#
    81  	# The disk size must be >= 10G to cover the image above.
    82  	# Ensure we use an instance with enough disk space.
    83  	#
    84  	juju deploy ./tests/suites/deploy/charms/centos-dummy-sink --base centos@9 --constraints root-disk=10G
    85  
    86  	juju status --format=json | jq '.applications."dummy-sink".base.name' | check "centos"
    87  	juju status --format=json | jq '.applications."dummy-sink".base.channel' | check "9"
    88  
    89  	wait_for "dummy-sink" "$(idle_condition "dummy-sink")"
    90  
    91  	destroy_model "${name}"
    92  }