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

     1  run_example1() {
     2  	# Echo out to ensure nice output to the test suite.
     3  	echo
     4  
     5  	# The following ensures that a bootstrap juju exists
     6  	file="${TEST_DIR}/test-example1.log"
     7  	ensure "example1" "${file}"
     8  
     9  	# Run your checks here
    10  	echo "Hello example 1!" | check "Hello example 1!"
    11  
    12  	# Clean up!
    13  	destroy_model "example1"
    14  }
    15  
    16  run_example2() {
    17  	echo
    18  
    19  	file="${TEST_DIR}/test-example2.log"
    20  	ensure "example2" "${file}"
    21  
    22  	echo "Hello example 2!" | check "Hello example 2!"
    23  
    24  	destroy_model "example2"
    25  }
    26  
    27  test_example() {
    28  	if [ -n "$(skip 'test_example')" ]; then
    29  		echo "==> SKIP: Asked to skip example tests"
    30  		return
    31  	fi
    32  
    33  	(
    34  		set_verbosity
    35  
    36  		cd .. || exit
    37  
    38  		run "run_example1"
    39  		run "run_example2"
    40  	)
    41  }