This attempts to retrieve cloudconfigs from two sources: the meta-data service, and the user-data service. If only one cloudconfig is found, that is applied to the system. If both services return a cloudconfig, the two are merged into a single cloudconfig which is then applied to the system. Only a subset of parameters are merged (because the meta-data service currently only partially populates a cloudconfig). In the event of any conflicts, parameters in the user-data cloudconfig take precedence over those in the meta-data cloudconfig.
		
			
				
	
	
		
			38 lines
		
	
	
		
			737 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			737 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash -e
 | 
						|
#
 | 
						|
# Run all coreos-cloudinit tests
 | 
						|
#   ./test
 | 
						|
#   ./test -v
 | 
						|
#
 | 
						|
# Run tests for one package
 | 
						|
#   PKG=initialize ./test
 | 
						|
#
 | 
						|
 | 
						|
# Invoke ./cover for HTML output
 | 
						|
COVER=${COVER:-"-cover"}
 | 
						|
 | 
						|
source ./build
 | 
						|
 | 
						|
declare -a TESTPKGS=(initialize system datasource pkg network)
 | 
						|
 | 
						|
if [ -z "$PKG" ]; then
 | 
						|
	GOFMTPATH="$TESTPKGS coreos-cloudinit.go"
 | 
						|
	# prepend repo path to each package
 | 
						|
	TESTPKGS="${TESTPKGS[@]/#/${REPO_PATH}/} ./"
 | 
						|
else
 | 
						|
	GOFMTPATH="$TESTPKGS"
 | 
						|
	# strip out slashes and dots from PKG=./foo/
 | 
						|
	TESTPKGS=${PKG//\//}
 | 
						|
	TESTPKGS=${TESTPKGS//./}
 | 
						|
	TESTPKGS=${TESTPKGS/#/${REPO_PATH}/}
 | 
						|
fi
 | 
						|
 | 
						|
echo "Running tests..."
 | 
						|
go test -i ${TESTPKGS}
 | 
						|
go test ${COVER} $@ ${TESTPKGS}
 | 
						|
 | 
						|
echo "Checking gofmt..."
 | 
						|
fmtRes=$(gofmt -l $GOFMTPATH)
 | 
						|
 | 
						|
echo "Success"
 |