-
Notifications
You must be signed in to change notification settings - Fork 0
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
Cass graphite intg test #67
base: master
Are you sure you want to change the base?
Conversation
test/integration.sh
Outdated
@@ -51,21 +51,36 @@ docker exec -it "$container_name" cqlsh -f "$schema_file" | |||
|
|||
# It's up! | |||
# Run integration test | |||
echo "Running integration test" | |||
int_test=$(./cdr_cass_integration_test.sh "$container_name" 2>&1) |
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.
Why did you change this?
On the lines above we create and start a cassandra container on port 9043 so we can run the tests without having to manually start cassandra as well as not having to shut down cassandra if it is already running on your local machine. This breaks it.
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.
I agree.
test/cdr_cass_integration_test.sh
Outdated
@@ -59,7 +59,9 @@ grep -q "${cassandra_port}=\"${cassandra_it_port}\"" "$app_conf_path" && echo -n | |||
|
|||
# Finally, run the jar. | |||
# Run with timeout | |||
timeout $timeout java -Dnetty.epoll.enabled=false -Dconfig.file=$(basename "$app_conf_path") -jar "$jar_directory" | |||
pwd |
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.
Remove
test/cdr_cass_integration_test.sh
Outdated
@@ -76,7 +78,7 @@ docker exec -i "$cass_container_name" cqlsh << EOF > "$temp_cassandra_result_fil | |||
use $cassandra_keyspace; | |||
select count(*) from $cassandra_cdr_table_name; | |||
EOF | |||
|
|||
#$cassandra_cdr_table_name; |
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.
What does this even do?
test/dbcIntegrationTest.sh
Outdated
# back to the directory you were in at start | ||
popd | ||
|
||
#now run curl to check if the data is at graphite. in this case we are lookng att callplan |
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.
Grammar/Spelling
Please use quotes for referencing speficic things here. we are looking for the product "CallPlanNormal"
test/dbcIntegrationTest.sh
Outdated
|
||
#check if the file contain data by | ||
# Read from file and grep for rows. | ||
#echo ${grep -Fxq "\[\]" $tempGraphiteFile} |
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.
Remove commented code
test/dbcIntegrationTest.sh
Outdated
fi | ||
|
||
#now remove the temp file | ||
rm -f $tempGraphiteFile |
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.
Why -f? this can be abused. Remove -f.
test/integration.sh
Outdated
@@ -51,21 +51,36 @@ docker exec -it "$container_name" cqlsh -f "$schema_file" | |||
|
|||
# It's up! | |||
# Run integration test | |||
echo "Running integration test" | |||
int_test=$(./cdr_cass_integration_test.sh "$container_name" 2>&1) |
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.
I agree.
test/cdr_cass_integration_test.sh
Outdated
@@ -12,7 +12,7 @@ app_conf_path="src/main/resources/application.conf" | |||
batch_limit="batch\.limit" | |||
batch_size_limit="cassandra\.element\.batch\.size" | |||
cassandra_port="port" | |||
cassandra_it_port=9043 | |||
cassandra_it_port=9042 |
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.
Please use 9043.
test/dbcIntegrationTest.sh
Outdated
#now run curl to check if the data is at graphite. in this case we are lookng att callplan | ||
curl '127.0.0.1:2000/render?target=qvantel.product.voice.CallPlanNormal&format=json' -o $tempGraphiteFile | ||
|
||
#check if the file contain data by |
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.
Inconsistent comment whitespace. The next comment uses
# Comment
and this one uses #Comment
. Use the first one.
test/dbcIntegrationTest.sh
Outdated
if grep -Fxq "[]" $tempGraphiteFile | ||
then | ||
#there are no records in this file | ||
echo "the dbconnector integration test failed!" |
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.
Indentation
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.
See my earlier review
test/cdr_cass_integration_test.sh
Outdated
@@ -59,7 +59,9 @@ grep -q "${cassandra_port}=\"${cassandra_it_port}\"" "$app_conf_path" && echo -n | |||
|
|||
# Finally, run the jar. | |||
# Run with timeout | |||
timeout $timeout java -Dnetty.epoll.enabled=false -Dconfig.file=$(basename "$app_conf_path") -jar "$jar_directory" | |||
pwd |
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.
Why is this here?
test/cdr_cass_integration_test.sh
Outdated
@@ -76,7 +78,7 @@ docker exec -i "$cass_container_name" cqlsh << EOF > "$temp_cassandra_result_fil | |||
use $cassandra_keyspace; | |||
select count(*) from $cassandra_cdr_table_name; | |||
EOF | |||
|
|||
#$cassandra_cdr_table_name; |
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 comment provides nothing
@@ -85,18 +84,18 @@ has_records=$(cat "$temp_cassandra_result_file" | grep -oP '\s+[0-9]+') | |||
|
|||
# use head and tail to get the first and last. | |||
has_records_cdr=$(echo "$has_records" | head -n+1) | |||
|
|||
# |
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.
Remove
# cleanup | ||
if [ -f "$temp_cassandra_result_file" ] | ||
then | ||
echo "Removed temp file" |
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.
Why switch all 4 space identations to 3 space identations?
test/dbcIntegrationTest.sh
Outdated
#!/bin/bash | ||
|
||
app_conf_path="src/main/resources/application.conf" | ||
limit="theLimit" |
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.
Please rename
test/dbcIntegrationTest.sh
Outdated
popd | ||
|
||
#now run curl to check if the data is at graphite. in this case we are looking for "callplanNormal" | ||
curl '127.0.0.1:2090/render?target=qvantel.product.voice.CallPlanNormal&format=json' -o $tempGraphiteFile |
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.
Please set variables for IP and port
if grep -Fxq "[]" $tempGraphiteFile | ||
then | ||
#there are no records in this file | ||
echo "the dbconnector integration test failed!" |
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.
Add identation
then | ||
#there are no records in this file | ||
echo "the dbconnector integration test failed!" | ||
echo "[-failed-]" |
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.
You need to set a non-zero exit code upon fail, otherwise travis will not report this as a failed test.
If you do cleanup in the end of this file you most likely want to set a variable with the exit code and to "exit $myvar" in the end
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.
Saw that you later in integration.sh use grep on this text.
Sure it works but it is very bad and can easily break, so please fix anyway.
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.
:( ok
|
||
# Finally, report back | ||
if [ -n "$(echo $int_test | grep '[SUCCESS]')" ] && [ $code -eq 0 ] | ||
then | ||
echo "Integration test successful" | ||
exit 0 |
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.
Why remove exit 0?
pair programmed with @Jozo95 results
-add a new dbconnector integration test file.
-updated integration file so that it runs integration test from cdr to graphite "all the way up".