-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wasabi integration test automation running in Vagrant (#238)
* Feature to enable integration test running in Vagrant. * Fixed readme * Fixed readme * Incorporated Nilesh's review feedback. * Use ${basedir} instead of relative path to copy *main-all.jar. * 1. Updated create_keyspace to use #!/usr/bin/env bash 2. Updated maven-resources-plugin to use 3.0.0 3. Commented maven-filtering dependency in maven-resources-plugin in parent pom as it should be automatically figured out the right version. * Need to update maven-resources-plugin version to 3.0.0 in swagger-ui as well. * Revert maven-resources-plugin version back to 2.7.
- Loading branch information
1 parent
ddfa1d1
commit 8d27e62
Showing
15 changed files
with
689 additions
and
0 deletions.
There are no files selected for viewing
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
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,21 @@ | ||
Vagrant.configure("2") do |config| | ||
|
||
config.vm.box = 'bento/centos-7.2' | ||
config.vm.provision "shell", :path => "provision.sh" | ||
config.vm.provision "shell", :path => "target/scripts/migration.sh" | ||
config.vm.provision "shell", :path => "target/scripts/server-start.sh" | ||
config.vm.provision "shell", :path => "target/scripts/run-it.sh" | ||
config.vm.provision "shell", :path => "target/scripts/server-stop.sh" | ||
|
||
config.vm.define :wasabiosit do |dev| | ||
dev.vm.hostname = "wasabi.os.it" | ||
dev.vm.boot_timeout = 3000 | ||
|
||
dev.vm.provider "virtualbox" do |v| | ||
v.name = "wasabi.os.it.vbox" | ||
v.memory = 4096 | ||
v.cpus = 4 | ||
v.customize ["modifyvm", :id, "--cableconnected1", "on"] | ||
end | ||
end | ||
end |
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
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,61 @@ | ||
############################################################################### | ||
# Copyright 2017 Intuit | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
############################################################################### | ||
#!/usr/bin/env bash | ||
|
||
exec > >(tee ./provision.log|logger -t provision -s 2>/dev/console) | ||
|
||
sudo yum -y install wget | ||
sudo yum -y install vim | ||
|
||
# install apache | ||
yum -y install httpd | ||
sudo service httpd start | ||
|
||
# install Oracle JDK | ||
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u92-b14/jdk-8u92-linux-x64.rpm" | ||
sudo yum -y localinstall jdk-8u92-linux-x64.rpm | ||
|
||
cat <<EOF | sudo tee -a /etc/yum.repos.d/datastax.repo | ||
[datastax] | ||
name = DataStax Repo for Apache Cassandra | ||
baseurl = http://rpm.datastax.com/community | ||
enabled = 1 | ||
gpgcheck = 0 | ||
EOF | ||
|
||
sudo yum -y install dsc21 | ||
sudo service cassandra start | ||
sudo systemctl enable cassandra.service | ||
|
||
# install mysql | ||
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm | ||
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm | ||
sudo yum -y update | ||
sudo yum -y install mysql-server | ||
sudo systemctl start mysqld | ||
|
||
# create MySQL db | ||
MYSQL_HOST="localhost" | ||
MYSQL_DBNAME="wasabi" | ||
|
||
mysql -s -N -h $MYSQL_HOST --execute="create database $MYSQL_DBNAME;" | ||
mysql -s -N -h $MYSQL_HOST --execute="create user 'readwrite'@'localhost' identified by 'readwrite';" | ||
mysql -s -N -h $MYSQL_HOST --execute="grant all privileges on wasabi.* to 'readwrite'@'localhost' identified by 'readwrite';" | ||
mysql -s -N -h $MYSQL_HOST --execute="flush privileges;" | ||
|
||
# install runit | ||
curl -s https://packagecloud.io/install/repositories/imeyer/runit/script.rpm.sh | sudo bash | ||
sudo yum -y install runit-2.1.2-3.el7.centos.x86_64 |
31 changes: 31 additions & 0 deletions
31
modules/functional-test/src/main/resources-filtered/cassandra_migration_rc.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,31 @@ | ||
############################################################################### | ||
# Copyright 2017 Intuit | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
############################################################################### | ||
#!/usr/bin/env bash | ||
|
||
export CASSANDRA_KEYSPACE=${cassandra.experiments.keyspaceName} | ||
export CASSANDRA_KEYSPACE_PREFIX=${cassandra.keyspace.prefix} | ||
|
||
export MIGRATION_SCRIPT_1=/vagrant/target/mutation/${wasabi.cassandra.migration.resource.path} | ||
export CASSANDRA_MIGRATION=/vagrant/target/cassandra-migration-${cassandra.migration.version}-jar-with-dependencies.jar | ||
export CQLSH_HOST=localhost | ||
export CASSANDRA_REPLICATION=1 | ||
|
||
echo CASSANDRA_KEYSPACE $CASSANDRA_KEYSPACE | ||
echo MIGRATION_SCRIPT_1 $MIGRATION_SCRIPT_1 | ||
echo CASSANDRA_MIGRATION $CASSANDRA_MIGRATION | ||
echo CASSANDRA_KEYSPACE_PREFIX $CASSANDRA_KEYSPACE_PREFIX | ||
echo CQLSH_HOST $CQLSH_HOST | ||
echo CASSANDRA_REPLICATION $CASSANDRA_REPLICATION |
28 changes: 28 additions & 0 deletions
28
modules/functional-test/src/main/resources-filtered/server-start.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,28 @@ | ||
############################################################################### | ||
# Copyright 2017 Intuit | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
############################################################################### | ||
#!/usr/bin/env bash | ||
|
||
APPLICATION_INSTRUMENT="-javaagent:/vagrant/target/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile=/vagrant/target/jacoco/jacoco-it.exec,append=false" | ||
CONSOLE_LOG=wasabi-os-console.log | ||
MAIN_JAR=/vagrant/target/wasabi-main-*-all.jar | ||
|
||
JAVA_OPTIONS="-server -Xmx4096m \ | ||
${APPLICATION_INSTRUMENT} \ | ||
-Dlogback.configurationFile=./logback.xml \ | ||
-Djava.util.logging.config.file=./logging.properties" | ||
|
||
|
||
java ${JAVA_OPTIONS} -jar ${MAIN_JAR} 1>>${CONSOLE_LOG} 2>&1 & |
39 changes: 39 additions & 0 deletions
39
modules/functional-test/src/main/scripts/create_keyspace.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,39 @@ | ||
############################################################################### | ||
# Copyright 2017 Intuit | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
############################################################################### | ||
#!/usr/bin/env bash | ||
|
||
echo "Creating Keyspace ${CASSANDRA_KEYSPACE_PREFIX}_experiments if it not exits" | ||
echo "cqlsh " \ | ||
"-e \"CREATE KEYSPACE IF NOT EXISTS ${CASSANDRA_KEYSPACE_PREFIX}_experiments WITH replication = {'class' : 'NetworkTopologyStrategy', 'datacenter1' : ${CASSANDRA_REPLICATION:-1}};\"" \ | ||
"--username=${CQLSH_USERNAME}" \ | ||
"--password=\"${CQLSH_PASSWORD}\"" \ | ||
"${CQLSH_HOST:-localhost}" \ | ||
"${CASSANDRA_PORT:-9042}" | ||
|
||
cqlsh \ | ||
-e "CREATE KEYSPACE IF NOT EXISTS ${CASSANDRA_KEYSPACE_PREFIX}_experiments WITH replication = {'class' : 'NetworkTopologyStrategy', 'datacenter1' : ${CASSANDRA_REPLICATION:-1}};" \ | ||
--username=${CQLSH_USERNAME} \ | ||
--password="${CQLSH_PASSWORD}" \ | ||
${CQLSH_HOST:-localhost} \ | ||
${CASSANDRA_PORT:-9042} | ||
|
||
|
||
if [ $? -ne 0 ]; then | ||
echo "failed to execute the create keyspace command. Please contact administrator." | ||
exit 1; | ||
fi | ||
|
||
echo "Done creating keyspace" |
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,29 @@ | ||
<!-- | ||
Copyright 2017 Intuit | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<configuration scan="true" scanPeriod="30 seconds"> | ||
|
||
<contextName>wasabi-intuit-main</contextName> | ||
<jmxConfigurator/> | ||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg %n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<root level="INFO"> | ||
<appender-ref ref="CONSOLE"/> | ||
</root> | ||
</configuration> |
Oops, something went wrong.