-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NU-1954] Namespace improvements: configurable separator, namespacing…
… Kafka consumer groups and missing Lite metric namespace tag (#7468)
- Loading branch information
Showing
14 changed files
with
186 additions
and
48 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
31 changes: 29 additions & 2 deletions
31
...nts-api/src/test/scala/pl/touk/nussknacker/engine/api/namespaces/NamingStrategySpec.scala
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 |
---|---|---|
@@ -1,21 +1,48 @@ | ||
package pl.touk.nussknacker.engine.api.namespaces | ||
|
||
import com.typesafe.config.ConfigFactory | ||
import org.scalatest.funsuite.AnyFunSuite | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
class NamingStrategySpec extends AnyFunSuite with Matchers { | ||
|
||
test("should leave original names if no namespace configured") { | ||
val defaultNaming = NamingStrategy(None) | ||
val defaultNaming = NamingStrategy.Disabled | ||
|
||
defaultNaming.prepareName("original") shouldBe "original" | ||
defaultNaming.decodeName("original") shouldBe Some("original") | ||
} | ||
|
||
test("should add namespace if configured") { | ||
val namingStrategy = NamingStrategy(Some("customer1")) | ||
val namingStrategy = NamingStrategy(Some(Namespace("customer1", "_"))) | ||
|
||
namingStrategy.prepareName("original") shouldBe "customer1_original" | ||
namingStrategy.decodeName("customer1_someName") shouldBe Some("someName") | ||
namingStrategy.decodeName("dummy??") shouldBe None | ||
} | ||
|
||
test("should read disabled naming strategy config") { | ||
val namingStrategy = NamingStrategy.fromConfig(ConfigFactory.empty()) | ||
|
||
namingStrategy.prepareName("original") shouldBe "original" | ||
} | ||
|
||
test("should read naming strategy config with default separator") { | ||
val config = ConfigFactory.parseString("""namespace: customer1""") | ||
|
||
val namingStrategy = NamingStrategy.fromConfig(config) | ||
|
||
namingStrategy.prepareName("original") shouldBe "customer1_original" | ||
} | ||
|
||
test("should read naming strategy config with specified separator") { | ||
val config = ConfigFactory.parseString(""" | ||
|namespace: customer1 | ||
|namespaceSeparator: "."""".stripMargin) | ||
|
||
val namingStrategy = NamingStrategy.fromConfig(config) | ||
|
||
namingStrategy.prepareName("original") shouldBe "customer1.original" | ||
} | ||
|
||
} |
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
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
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
Oops, something went wrong.