-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added no-chunk option in series API (#1904)
Signed-off-by: yeya24 <[email protected]> add e2e tests Signed-off-by: yeya24 <[email protected]> add tests for all stores Signed-off-by: yeya24 <[email protected]> add changelog Signed-off-by: yeya24 <[email protected]>
- Loading branch information
Showing
18 changed files
with
664 additions
and
245 deletions.
There are no files selected for viewing
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package store | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/thanos-io/thanos/pkg/store/storepb" | ||
"github.com/thanos-io/thanos/pkg/testutil" | ||
) | ||
|
||
func TestMatchersToString(t *testing.T) { | ||
cases := []struct { | ||
ms []storepb.LabelMatcher | ||
expected string | ||
}{ | ||
{ | ||
ms: []storepb.LabelMatcher{ | ||
{ | ||
Name: "__name__", | ||
Type: storepb.LabelMatcher_EQ, | ||
Value: "up", | ||
}}, | ||
expected: `{__name__="up"}`, | ||
}, | ||
{ | ||
ms: []storepb.LabelMatcher{ | ||
{ | ||
Name: "__name__", | ||
Type: storepb.LabelMatcher_NEQ, | ||
Value: "up", | ||
}, | ||
{ | ||
Name: "job", | ||
Type: storepb.LabelMatcher_EQ, | ||
Value: "test", | ||
}, | ||
}, | ||
expected: `{__name__!="up", job="test"}`, | ||
}, | ||
{ | ||
ms: []storepb.LabelMatcher{ | ||
{ | ||
Name: "__name__", | ||
Type: storepb.LabelMatcher_EQ, | ||
Value: "up", | ||
}, | ||
{ | ||
Name: "job", | ||
Type: storepb.LabelMatcher_RE, | ||
Value: "test", | ||
}, | ||
}, | ||
expected: `{__name__="up", job=~"test"}`, | ||
}, | ||
{ | ||
ms: []storepb.LabelMatcher{ | ||
{ | ||
Name: "job", | ||
Type: storepb.LabelMatcher_NRE, | ||
Value: "test", | ||
}}, | ||
expected: `{job!~"test"}`, | ||
}, | ||
{ | ||
ms: []storepb.LabelMatcher{ | ||
{ | ||
Name: "__name__", | ||
Type: storepb.LabelMatcher_EQ, | ||
Value: "up", | ||
}, | ||
{ | ||
Name: "__name__", | ||
Type: storepb.LabelMatcher_NEQ, | ||
Value: "up", | ||
}, | ||
}, | ||
// We cannot use up{__name__!="up"} in this case. | ||
expected: `{__name__="up", __name__!="up"}`, | ||
}, | ||
} | ||
|
||
for i, c := range cases { | ||
actual, err := matchersToString(c.ms) | ||
testutil.Ok(t, err) | ||
testutil.Assert(t, actual == c.expected, "test case %d failed, expected %s, actual %s", i, c.expected, actual) | ||
} | ||
} |
Oops, something went wrong.