Skip to content
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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Cass graphite intg test #67

wants to merge 11 commits into from

Conversation

geewarges
Copy link
Collaborator

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".

@@ -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)
Copy link
Collaborator

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.

@@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

@@ -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;
Copy link
Collaborator

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?

# 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
Copy link
Collaborator

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"


#check if the file contain data by
# Read from file and grep for rows.
#echo ${grep -Fxq "\[\]" $tempGraphiteFile}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented code

fi

#now remove the temp file
rm -f $tempGraphiteFile
Copy link
Collaborator

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.

@@ -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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.

@@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use 9043.

#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
Copy link
Collaborator

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.

if grep -Fxq "[]" $tempGraphiteFile
then
#there are no records in this file
echo "the dbconnector integration test failed!"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation

Copy link
Collaborator

@Lilja Lilja left a 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

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this here?

@@ -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;
Copy link
Contributor

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)

#
Copy link
Collaborator

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"
Copy link
Collaborator

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?

#!/bin/bash

app_conf_path="src/main/resources/application.conf"
limit="theLimit"
Copy link
Collaborator

@johan-bjareholt johan-bjareholt May 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename

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
Copy link
Collaborator

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!"
Copy link
Collaborator

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-]"
Copy link
Collaborator

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

Copy link
Collaborator

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.

Copy link
Collaborator Author

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove exit 0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants