From 27059d4f3b2ebcc004aa37ba9fa9efa67e8a2148 Mon Sep 17 00:00:00 2001 From: Thibault Charbonnier Date: Thu, 2 Feb 2017 16:48:33 -0800 Subject: [PATCH] tests(dao) fix DAO testss erroring with Cassandra We need to flush the shm after it stores C* nodes as being down due to intentional failure to connect to it. --- spec/02-integration/02-dao/02-migrations_spec.lua | 6 ++++++ spec/02-integration/02-dao/03-crud_spec.lua | 2 ++ 2 files changed, 8 insertions(+) diff --git a/spec/02-integration/02-dao/02-migrations_spec.lua b/spec/02-integration/02-dao/02-migrations_spec.lua index 8a366f3519f8..f059f19c2e1b 100644 --- a/spec/02-integration/02-dao/02-migrations_spec.lua +++ b/spec/02-integration/02-dao/02-migrations_spec.lua @@ -10,6 +10,11 @@ helpers.for_each_dao(function(kong_config) local f = Factory(kong_config) f:drop_schema() end) + + teardown(function() + ngx.shared.cassandra:flush_expired() + end) + before_each(function() factory = Factory(kong_config) end) @@ -105,6 +110,7 @@ helpers.for_each_dao(function(kong_config) kong_config.pg_port = pg_port kong_config.cassandra_port = cassandra_port kong_config.cassandra_timeout = cassandra_timeout + ngx.shared.cassandra:flush_all() end) kong_config.pg_port = 3333 kong_config.cassandra_port = 3333 diff --git a/spec/02-integration/02-dao/03-crud_spec.lua b/spec/02-integration/02-dao/03-crud_spec.lua index 613aa27bfc00..d9a3b464e9eb 100644 --- a/spec/02-integration/02-dao/03-crud_spec.lua +++ b/spec/02-integration/02-dao/03-crud_spec.lua @@ -45,6 +45,7 @@ helpers.for_each_dao(function(kong_config) end) teardown(function() factory:truncate_tables() + ngx.shared.cassandra:flush_expired() end) describe("insert()", function() @@ -701,6 +702,7 @@ helpers.for_each_dao(function(kong_config) kong_config.pg_port = pg_port kong_config.cassandra_port = cassandra_port kong_config.cassandra_timeout = cassandra_timeout + ngx.shared.cassandra:flush_all() end) kong_config.pg_port = 3333 kong_config.cassandra_port = 3333