diff --git a/.ci/run_tests.sh b/.ci/run_tests.sh index c041d493..aace3bbf 100755 --- a/.ci/run_tests.sh +++ b/.ci/run_tests.sh @@ -4,7 +4,7 @@ set -e if [ "$OPENRESTY_TESTS" != "yes" ]; then make lint - busted -v --coverage -o gtest + busted -v --coverage -o gtest --repeat 3 luacov-coveralls -i cassandra else prove -l t diff --git a/spec/integration/cassandra_spec.lua b/spec/integration/cassandra_spec.lua index 9c2b57f5..aa239b7b 100644 --- a/spec/integration/cassandra_spec.lua +++ b/spec/integration/cassandra_spec.lua @@ -119,7 +119,7 @@ describe("spawn_session()", function() describe("execute()", function() after_each(function() -- drop keyspace in case tests failed - session:execute("DROP KEYSPACE resty_cassandra_spec") + spec_utils.drop_keyspace(session, "resty_cassandra_spec") end) it("should require argument #1 to be a string", function() assert.has_error(function() @@ -221,7 +221,7 @@ describe("spawn_session()", function() assert.falsy(err) _, err = session:execute [[ - CREATE TABLE resty_cassandra_spec.fixture_table( + CREATE TABLE IF NOT EXISTS resty_cassandra_spec.fixture_table( id uuid PRIMARY KEY, value varchar ) diff --git a/spec/spec_utils.lua b/spec/spec_utils.lua index 0108cae5..1dddc8a1 100644 --- a/spec/spec_utils.lua +++ b/spec/spec_utils.lua @@ -25,11 +25,7 @@ function _M.create_keyspace(session, keyspace) end function _M.drop_keyspace(session, keyspace) - local res, err = session:execute("DROP KEYSPACE "..keyspace) - if err then - error(err) - end - return res + session:execute("DROP KEYSPACE "..keyspace) end local delta = 0.0000001