From 5c643cf1fa5ae06f9c163c11aecc1b4695d31603 Mon Sep 17 00:00:00 2001 From: Caio Almeida <117518+caiosba@users.noreply.github.com> Date: Wed, 5 Jun 2024 12:56:30 -0300 Subject: [PATCH] Fixing flaky integration tests (#1910) --- test/integration/api_version_integration_test.rb | 5 +++-- test/integration/dynamic_annotation_integration_test.rb | 5 +++++ test/integration/short_url_integration_test.rb | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/test/integration/api_version_integration_test.rb b/test/integration/api_version_integration_test.rb index 9f67ffd59e..23936aea49 100644 --- a/test/integration/api_version_integration_test.rb +++ b/test/integration/api_version_integration_test.rb @@ -1,8 +1,9 @@ require_relative '../test_helper' class ApiVersionIntegrationTest < ActionDispatch::IntegrationTest - def setup - super + setup do + redis = Redis.new(REDIS_CONFIG) + redis.flushdb end test "should get default version 1" do diff --git a/test/integration/dynamic_annotation_integration_test.rb b/test/integration/dynamic_annotation_integration_test.rb index 8691d97b69..17b6c96390 100644 --- a/test/integration/dynamic_annotation_integration_test.rb +++ b/test/integration/dynamic_annotation_integration_test.rb @@ -1,6 +1,11 @@ require_relative '../test_helper' class DynamicAnnotationIntegrationTest < ActionDispatch::IntegrationTest + setup do + redis = Redis.new(REDIS_CONFIG) + redis.flushdb + end + test "should create task response free text" do assert_nothing_raised do at = create_annotation_type annotation_type: 'task_response_free_text', label: 'Task Response Free Text', description: 'Free text response that can added to a task' diff --git a/test/integration/short_url_integration_test.rb b/test/integration/short_url_integration_test.rb index f0592e008d..87a5a95416 100644 --- a/test/integration/short_url_integration_test.rb +++ b/test/integration/short_url_integration_test.rb @@ -1,6 +1,11 @@ require_relative '../test_helper' class ShortUrlIntegrationTest < ActionDispatch::IntegrationTest + setup do + redis = Redis.new(REDIS_CONFIG) + redis.flushdb + end + test "should not access by other host other than the short host" do assert_routing "#{CheckConfig.get('short_url_host')}/x1y2z3", { host: 'localhost', controller: 'shortener/shortened_urls', action: 'show', id: 'x1y2z3' } end