-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for testing fresh install as well as upgrade. #173
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 rpm --erase | ||
rm -rf /etc/xdmod | ||
rm -rf /var/lib/mysql | ||
rpm -ivh ~/rpmbuild/RPMS/*/*.rpm | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be switched to yum |
||
~/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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be yum at least the
rpm --erase
part