Skip to content

Commit

Permalink
✅ Run more tests synchronously
Browse files Browse the repository at this point in the history
More test files are using the same SDK keys which results in test failures when two tests with the same key try to start their own ConfigCat instances. Since we only allow a single instance per SDK key, this fails.
  • Loading branch information
randycoulman committed Jan 10, 2024
1 parent 7089e6c commit ef0a042
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions samples/multi/lib/multi.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ defmodule Multi do

defmodule First do
@moduledoc false
use ConfigCat, sdk_key: "PKDVCLf-Hq-h-kCzMp-L7Q/psuH7BGHoUmdONrzzUOY7A"
use ConfigCat, sdk_key: "configcat-sdk-1/PKDVCLf-Hq-h-kCzMp-L7Q/AG6C1ngVb0CvM07un6JisQ"
end

defmodule Second do
@moduledoc false
use ConfigCat, sdk_key: "PKDVCLf-Hq-h-kCzMp-L7Q/HhOWfwVtZ0mb30i9wi17GQ"
use ConfigCat, sdk_key: "configcat-sdk-1/PKDVCLf-Hq-h-kCzMp-L7Q/tiOvFw5gkky9LFu1Duuvzw"
end

def start_link(_options) do
Expand Down
2 changes: 1 addition & 1 deletion samples/simple/lib/simple/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule Simple.Application do

require Logger

@sdk_key "PKDVCLf-Hq-h-kCzMp-L7Q/psuH7BGHoUmdONrzzUOY7A"
@sdk_key "configcat-sdk-1/PKDVCLf-Hq-h-kCzMp-L7Q/AG6C1ngVb0CvM07un6JisQ"

@impl Application
def start(_type, _args) do
Expand Down
5 changes: 4 additions & 1 deletion test/flag_override_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
defmodule ConfigCat.FlagOverrideTest do
use ConfigCat.ClientCase, async: true
# Must be async: false to avoid a collision with other tests.
# Now that we only allow a single ConfigCat instance to use the same SDK key,
# one of the async tests would fail due to the existing running instance.
use ConfigCat.ClientCase, async: false

import Jason.Sigil

Expand Down
2 changes: 1 addition & 1 deletion test/integration_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ defmodule ConfigCat.IntegrationTest do
alias ConfigCat.InMemoryCache
alias ConfigCat.LocalMapDataSource

@sdk_key "PKDVCLf-Hq-h-kCzMp-L7Q/PaDVCFk9EpmD6sLpGLltTA"
@sdk_key "configcat-sdk-1/PKDVCLf-Hq-h-kCzMp-L7Q/1cGEJXUwYUGZCBOL-E2sOw"

describe "SDK key validation" do
test "raises error if SDK key is missing" do
Expand Down
5 changes: 4 additions & 1 deletion test/rollout_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
defmodule ConfigCat.RolloutTest do
use ConfigCat.Case, async: true
# Must be async: false to avoid a collision with other tests.
# Now that we only allow a single ConfigCat instance to use the same SDK key,
# one of the async tests would fail due to the existing running instance.
use ConfigCat.Case, async: false

import ExUnit.CaptureLog
import Jason.Sigil
Expand Down
2 changes: 1 addition & 1 deletion test/using_block_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule ConfigCat.UsingBlockTest do

defmodule CustomModule do
@moduledoc false
use ConfigCat, sdk_key: "PKDVCLf-Hq-h-kCzMp-L7Q/PaDVCFk9EpmD6sLpGLltTA"
use ConfigCat, sdk_key: "configcat-sdk-1/PKDVCLf-Hq-h-kCzMp-L7Q/1cGEJXUwYUGZCBOL-E2sOw"
end

test "can call API through using block" do
Expand Down

0 comments on commit ef0a042

Please sign in to comment.