<commit_before>#! /bin/bash
# file: tests/test_integration_drupal.sh

# shunit2 compatible unittest file, requires shunit2 installed (apt-get install shunit2)

# Tests
# 01. Create Vre Drupal server
# 02. Destroy Vre Drupal server

# Load test helpers
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
. "${DIR}"/shunit2_helpers.sh

# Get this test suite's name
FULLNAME="$(basename "$0")"
THIS_TEST="${FULLNAME%.*}"

oneTimeSetUp(){
	# runs before whole test suite
	checkPrereqs
}

oneTimeTearDown(){
	# runs after whole test suite
	rm -f _tmp.txt
	unset SSHPASS
	[ "$KAMAKI_CLEANUP" = "true" ] && { rm -f ~/.kamakirc; }
}

tearDown(){
	# runs after each separate test
	unset RESULT
	rm -f _tmp.txt
	endSkipping
}

# 01 
testDrupalCreate(){
	# arrange
	# act
	if [ "$DO_INTEGRATION_TEST" = "$THIS_TEST" ] || [ "$FULL_TESTSUITE" = "true" ]; then
		# orka vre create name_of_server server_cpus server_ram server_disksize disk_template project_name
		local COMMAND='orka vre create drupal_integration_test 2 2048 20 Standard '"${OKEANOS_PROJECT}"' --image Deb8\-Drupal\-Final >_tmp.txt 2> /dev/null'
		( $(eval $COMMAND) ) & keepAlive $! " Working"
		declare -a ARR_RESULT=($(cat _tmp.txt))
		# server_id: xx\nserver_IP: x.x.x.x\nroot password: <PASSWORD>
		# (7 items, 0-based array, so relevant items at positions 1(server_id), 3(server_IP), 6(password))
		SERVER_ID=${ARR_RESULT[1]}
		SERVER_IP=${ARR_RESULT[3]}
		export SSHPASS=${ARR_RESULT[6]}		
		fi
	else
		startSkipping
	fi
	# assert (assert* "fail message" <success_condition>)
	assertTrue 'Create Drupal Vre Server Failed' '[ -n "$SERVER_ID" ]'
}

# 02 Destroy<commit_msg>Syntax fix in drupal integration test<commit_after>#! /bin/bash
# file: tests/test_integration_drupal.sh

# shunit2 compatible unittest file, requires shunit2 installed (apt-get install shunit2)

# Tests
# 01. Create Vre Drupal server
# 02. Destroy Vre Drupal server

# Load test helpers
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
. "${DIR}"/shunit2_helpers.sh

# Get this test suite's name
FULLNAME="$(basename "$0")"
THIS_TEST="${FULLNAME%.*}"

oneTimeSetUp(){
	# runs before whole test suite
	checkPrereqs
}

oneTimeTearDown(){
	# runs after whole test suite
	rm -f _tmp.txt
	unset SSHPASS
	[ "$KAMAKI_CLEANUP" = "true" ] && { rm -f ~/.kamakirc; }
}

tearDown(){
	# runs after each separate test
	unset RESULT
	rm -f _tmp.txt
	endSkipping
}

# 01 
testDrupalCreate(){
	# arrange
	# act
	if [ "$DO_INTEGRATION_TEST" = "$THIS_TEST" ] || [ "$FULL_TESTSUITE" = "true" ]; then
		# orka vre create name_of_server server_cpus server_ram server_disksize disk_template project_name
		local COMMAND='orka vre create drupal_integration_test 2 2048 20 Standard '"${OKEANOS_PROJECT}"' --image Deb8\-Drupal\-Final >_tmp.txt 2> /dev/null'
		( $(eval $COMMAND) ) & keepAlive $! " Working"
		declare -a ARR_RESULT=($(cat _tmp.txt))
		# server_id: xx\nserver_IP: x.x.x.x\nroot password: <PASSWORD>
		# (7 items, 0-based array, so relevant items at positions 1(server_id), 3(server_IP), 6(password))
		SERVER_ID=${ARR_RESULT[1]}
		SERVER_IP=${ARR_RESULT[3]}
		export SSHPASS=${ARR_RESULT[6]}
	else
		startSkipping
	fi
	# assert (assert* "fail message" <success_condition>)
	assertTrue 'Create Drupal Vre Server Failed' '[ -n "$SERVER_ID" ]'
}

# 02 Destroy
{'fraction_non_alphanumeric': 0.14246575342465753, 'fraction_numerical': 0.018873668188736682, 'mean_word_length': 4.617094017094017, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2969972', 'n_tokens_mistral': 1307, 'n_tokens_neox': 1224, 'n_words': 321}