-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
62 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{-# OPTIONS_GHC -Wno-orphans #-} | ||
|
||
module HStream.Kafka.Common.ConfigSpec where | ||
|
||
import qualified Data.Map.Strict as M | ||
import HStream.Kafka.Server.Config | ||
import Test.Hspec | ||
|
||
spec :: Spec | ||
spec = describe "KafkaConfigTest" $ do | ||
|
||
it "mergeConfigs" $ do | ||
let kc1 = mkKafkaBrokerConfigs $ M.fromList | ||
[ | ||
("auto.create.topics.enable", "false"), | ||
("num.partitions", "2"), | ||
("offsets.topic.replication.factor", "1") | ||
] | ||
let kc2 = mkKafkaBrokerConfigs $ M.fromList | ||
[ | ||
("num.partitions", "3"), | ||
("default.replication.factor", "2"), | ||
("offsets.topic.replication.factor", "2") | ||
] | ||
let expected = mkKafkaBrokerConfigs $ M.fromList | ||
[ | ||
-- values not set by kc2 will be set by kc1 | ||
("auto.create.topics.enable", "false"), | ||
-- values set by kc2 will overrid values set by kc1 | ||
("num.partitions", "3"), | ||
("default.replication.factor", "2"), | ||
("offsets.topic.replication.factor", "2") | ||
] | ||
let kc = mergeBrokerConfigs kc1 kc2 | ||
kc `shouldBe` expected |