Skip to content
This repository has been archived by the owner on Oct 17, 2018. It is now read-only.

Commit

Permalink
Rebase fallout part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitriy Gromov committed Sep 25, 2017
1 parent 19f64a4 commit df0389b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 69 deletions.
66 changes: 6 additions & 60 deletions rules/mapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,50 +285,6 @@ func TestMappingRuleSnapshotClone(t *testing.T) {
require.NotEqual(t, s1.policies, s1Clone.policies)
}

<<<<<<< HEAD
func TestNewMappingRuleView(t *testing.T) {
mr, err := newMappingRule(testMappingRuleSchema, testTagsFilterOptions())
require.NoError(t, err)

<<<<<<< HEAD
actual, err := mr.mappingRuleView(0)
=======
actual, err := mr.mappingRuleView(len(mr.snapshots) - 1)
>>>>>>> Addressing comments:
require.NoError(t, err)

p1, _ := policy.ParsePolicy("1m:24h")
p2, _ := policy.ParsePolicy("5m:2d")
expected := &MappingRuleView{
ID: "12669817-13ae-40e6-ba2f-33087b262c68",
Name: "bar",
CutoverNanos: 67890,
Tombstoned: true,
LastUpdatedAtNanos: 1234,
LastUpdatedBy: "someone",
Filters: map[string]string{
"tag3": "value3",
"tag4": "value4",
},
Policies: []policy.Policy{p1, p2},
}
require.Equal(t, expected, actual)
}

func TestNewMappingRuleViewError(t *testing.T) {
mr, err := newMappingRule(testMappingRuleSchema, testTagsFilterOptions())
require.NoError(t, err)

badIdx := []int{-2, 2, 30}
for _, i := range badIdx {
actual, err := mr.mappingRuleView(i)
require.Error(t, err)
require.Nil(t, actual)
}
}

=======
>>>>>>> Rebase + Fallout
func TestMappingRuleHistory(t *testing.T) {
mr, err := newMappingRule(testMappingRuleSchema, testTagsFilterOptions())
require.NoError(t, err)
Expand All @@ -339,7 +295,6 @@ func TestMappingRuleHistory(t *testing.T) {
p0, _ := policy.ParsePolicy("10s:24h|P999")
p1, _ := policy.ParsePolicy("1m:24h")
p2, _ := policy.ParsePolicy("5m:2d")
<<<<<<< HEAD

expectedViews := []*MappingRuleView{
&MappingRuleView{
Expand All @@ -351,7 +306,9 @@ func TestMappingRuleHistory(t *testing.T) {
"tag3": "value3",
"tag4": "value4",
},
Policies: []policy.Policy{p1, p2},
Policies: []policy.Policy{p1, p2},
LastUpdatedAtNanos: 1234,
LastUpdatedBy: "someone",
},
&MappingRuleView{
ID: "12669817-13ae-40e6-ba2f-33087b262c68",
Expand All @@ -362,21 +319,10 @@ func TestMappingRuleHistory(t *testing.T) {
"tag1": "value1",
"tag2": "value2",
},
Policies: []policy.Policy{p0},
},
=======
expected := &MappingRuleView{
ID: "12669817-13ae-40e6-ba2f-33087b262c68",
Name: "bar",
CutoverNanos: 67890,
Filters: map[string]string{
"tag3": "value3",
"tag4": "value4",
Policies: []policy.Policy{p0},
LastUpdatedAtNanos: 1234,
LastUpdatedBy: "someone",
},
Policies: []policy.Policy{p1, p2},
LastUpdatedAtNanos: 1234,
LastUpdatedBy: "someone",
>>>>>>> Rebase + Fallout
}

require.Equal(t, expectedViews, hist)
Expand Down
21 changes: 12 additions & 9 deletions rules/rollup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,10 @@ func TestNewRollupRuleHistory(t *testing.T) {
p2, _ := policy.ParsePolicy("5m:2d|Mean")
expected := []*RollupRuleView{
&RollupRuleView{
ID: "12669817-13ae-40e6-ba2f-33087b262c68",
Name: "bar",
CutoverNanos: 67890,
Tombstoned: true,
ID: "12669817-13ae-40e6-ba2f-33087b262c68",
Name: "bar",
CutoverNanos: 67890,
Tombstoned: true,
LastUpdatedAtNanos: 67890,
LastUpdatedBy: "someone",
Filters: map[string]string{
Expand All @@ -445,13 +445,16 @@ func TestNewRollupRuleHistory(t *testing.T) {
Name: "rName1",
Tags: []string{"rtagName1", "rtagName2"},
Policies: []policy.Policy{p1, p2},
"tag4": "value4",
},
},
},
&RollupRuleView{
ID: "12669817-13ae-40e6-ba2f-33087b262c68",
Name: "foo",
CutoverNanos: 12345,
Tombstoned: false,
ID: "12669817-13ae-40e6-ba2f-33087b262c68",
Name: "foo",
CutoverNanos: 12345,
Tombstoned: false,
LastUpdatedAtNanos: 12345,
LastUpdatedBy: "someone-else",
Filters: map[string]string{
"tag1": "value1",
"tag2": "value2",
Expand Down

0 comments on commit df0389b

Please sign in to comment.