-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #173 from jpwhite4/xdmodsetup
Add support for testing fresh install as well as upgrade.
- Loading branch information
Showing
3 changed files
with
172 additions
and
6 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
open_xdmod/modules/xdmod/integration_tests/scripts/bootstrap.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
# Bootstrap script that either sets up a fresh XDMoD test instance or upgrades | ||
# an existing one. This code is only designed to work inside the XDMoD test | ||
# docker instances. However, since it is designed to test a real install, the | ||
# set of commands that are run would work on a real production system. | ||
|
||
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
REF_DIR=/root/assets/referencedata | ||
|
||
set -e | ||
set -o pipefail | ||
|
||
if [ "$XDMOD_TEST_MODE" = "fresh_install" ]; | ||
then | ||
rpm -qa | grep ^xdmod | xargs yum -y remove | ||
rm -rf /etc/xdmod | ||
rm -rf /var/lib/mysql | ||
yum -y localinstall ~/rpmbuild/RPMS/*/*.rpm | ||
~/bin/services start | ||
expect $BASEDIR/xdmod-setup.tcl | col -b | ||
for resource in $REF_DIR/*.log; do | ||
xdmod-shredder -r `basename $resource .log` -f slurm -i $resource; | ||
done | ||
xdmod-ingestor | ||
xdmod-import-csv -t names -i $REF_DIR/names.csv | ||
xdmod-ingestor | ||
php /root/bin/createusers.php | ||
fi | ||
|
||
if [ "$XDMOD_TEST_MODE" = "upgrade" ]; | ||
then | ||
rpm -Uvh ~/rpmbuild/RPMS/*/*.rpm | ||
~/bin/services start | ||
xdmod-upgrade --batch-mode | col -b | ||
fi |
130 changes: 130 additions & 0 deletions
130
open_xdmod/modules/xdmod/integration_tests/scripts/xdmod-setup.tcl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
#!/usr/bin/env expect | ||
# Expect script that run s xdmod-setup to configure a freshly installed | ||
# XDMoD instance. This script will fail if run against an already installed | ||
# XDMoD. | ||
|
||
#------------------------------------------------------------------------------- | ||
# Configuration settings for the XDMoD resources | ||
set resources [list] | ||
lappend resources [list frearson Frearson 400 4000] | ||
lappend resources [list mortorq Mortorq 400 4000] | ||
lappend resources [list phillips Phillips 400 4000] | ||
lappend resources [list pozidriv Posidriv 400 4000] | ||
lappend resources [list robertson Robertson 400 4000] | ||
|
||
#------------------------------------------------------------------------------- | ||
# Helper functions | ||
|
||
proc selectMenuOption { option } { | ||
|
||
expect { | ||
-re "\nSelect an option .*: " | ||
} | ||
send $option\n | ||
} | ||
|
||
proc answerQuestion { question response } { | ||
expect { | ||
timeout { send_user "\nFailed to get prompt\n"; exit 1 } | ||
-re "\n$question: \\\[.*\\\] " | ||
} | ||
send $response\n | ||
} | ||
|
||
proc provideInput { prompt response } { | ||
expect { | ||
timeout { send_user "\nFailed to get prompt\n"; exit 1 } | ||
"\n$prompt " | ||
} | ||
send $response\n | ||
} | ||
|
||
proc providePassword { prompt password } { | ||
provideInput $prompt $password | ||
provideInput "(confirm) $prompt" $password | ||
|
||
} | ||
|
||
proc enterToContinue { } { | ||
expect { | ||
timeout { send_user "\nFailed to get prompt\n"; exit 1 } | ||
"\nPress ENTER to continue. " | ||
} | ||
send \n | ||
} | ||
|
||
proc confirmFileWrite { response } { | ||
expect { | ||
timeout { send_user "\nFailed to get prompt\n"; exit 1 } | ||
-re "\nOverwrite config file .*\\\[.*\\\] " | ||
} | ||
send $response\n | ||
} | ||
|
||
#------------------------------------------------------------------------------- | ||
# main body - note there are some hardcoded addresses, usernames and passwords here | ||
# they should typically not be changed as they need to match up with the | ||
# settings in the docker container | ||
|
||
set timeout 10 | ||
spawn "xdmod-setup" | ||
|
||
selectMenuOption 1 | ||
answerQuestion {Site Address} http://localhost:8080/ | ||
provideInput {Email Address:} ccr-xdmod-help@buffalo.edu | ||
answerQuestion {Java Path} /usr/bin/java | ||
answerQuestion {Javac Path} /usr/bin/javac | ||
provideInput {PhantomJS Path:} /usr/local/bin/phantomjs | ||
provideInput {Center Logo Path:} {} | ||
confirmFileWrite yes | ||
enterToContinue | ||
|
||
selectMenuOption 2 | ||
answerQuestion {DB Hostname or IP} localhost | ||
answerQuestion {DB Port} 3306 | ||
answerQuestion {DB Username} xdmod | ||
providePassword {DB Password:} xdmod123 | ||
answerQuestion {DB Admin Username} root | ||
providePassword {DB Admin Password:} {} | ||
confirmFileWrite yes | ||
enterToContinue | ||
|
||
selectMenuOption 3 | ||
provideInput {Organization Name:} Screwdriver | ||
provideInput {Organization Abbreviation:} screw | ||
confirmFileWrite yes | ||
enterToContinue | ||
|
||
selectMenuOption 4 | ||
foreach resource $resources { | ||
selectMenuOption 1 | ||
provideInput {Resource Name:} [lindex $resource 0] | ||
provideInput {Formal Name:} [lindex $resource 1] | ||
provideInput {How many nodes does this resource have?} [lindex $resource 2] | ||
provideInput {How many total processors (cpu cores) does this resource have?} [lindex $resource 3] | ||
} | ||
selectMenuOption s | ||
confirmFileWrite yes | ||
enterToContinue | ||
confirmFileWrite yes | ||
enterToContinue | ||
|
||
selectMenuOption 5 | ||
provideInput {Username:} admin | ||
providePassword {Password:} admin | ||
provideInput {First name:} Admin | ||
provideInput {Last name:} User | ||
provideInput {Email address:} admin@localhost | ||
enterToContinue | ||
|
||
selectMenuOption 6 | ||
answerQuestion {Top Level Name} {Decanal Unit} | ||
provideInput {Top Level Description:} {Decanal Unit} | ||
answerQuestion {Middle Level Name} {Department} | ||
provideInput {Middle Level Description:} {Department} | ||
answerQuestion {Bottom Level Name} {PI Group} | ||
provideInput {Bottom Level Description:} {PI Group} | ||
confirmFileWrite yes | ||
enterToContinue | ||
|
||
selectMenuOption q |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
language: none | ||
env: | ||
- XDMOD_TEST_MODE=fresh_install | ||
- XDMOD_TEST_MODE=upgrade | ||
build: | ||
cache: true | ||
cache_dir_list: | ||
- /root/.composer | ||
pre_ci_boot: | ||
image_name: tas-tools-ext-01.ccr.xdmod.org/centos7-xdmod6.6.0 | ||
image_tag: version3 | ||
image_tag: version4 | ||
pull: true | ||
options: "--user root -e HOME=/root" | ||
ci: | ||
- composer install | ||
- composer install --no-progress | ||
- ~/bin/buildrpm xdmod | ||
- rpm -Uvh --oldpackage ~/rpmbuild/RPMS/*/*.rpm | ||
- ~/bin/services start | ||
- xdmod-upgrade --batch-mode | col -bx | ||
- ./open_xdmod/modules/xdmod/integration_tests/scripts/bootstrap.sh | ||
- composer install --no-progress | ||
- cp ~/assets/secrets open_xdmod/modules/xdmod/integration_tests/.secrets | ||
- composer --dev install | ||
- ./open_xdmod/modules/xdmod/integration_tests/runtests.sh --log-junit `pwd`/shippable/testresults/results.xml |