-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LOG-4095: fix labels with more then one dot
- Loading branch information
Showing
3 changed files
with
27 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package loki | ||
|
||
import ( | ||
"fmt" | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/ginkgo/extensions/table" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = Describe("Loki generator helpers", func() { | ||
|
||
DescribeTable("#formatLokiLabelValue should correctly format", func(label, exp string) { | ||
Expect(fmt.Sprintf("{{%s}}", exp)).To(Equal(formatLokiLabelValue(label))) | ||
}, | ||
Entry(" for a complex label", "kubernetes.labels.app.kubernetes.io/name", "kubernetes.labels.app_kubernetes_io_name"), | ||
Entry(" for a label with only a slash", "kubernetes.labels.foo/bar", "kubernetes.labels.foo_bar"), | ||
Entry(" for a namespacelabel with only a slash", "kubernetes.namespace_labels.foo/bar", "kubernetes.namespace_labels.foo_bar"), | ||
Entry(" for a simple label", "kubernetes.labels.foo", "kubernetes.labels.foo"), | ||
Entry(" for a label without kubernetes.labels prefix", "kubernetes.host", "kubernetes.host"), | ||
) | ||
|
||
}) |
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