Skip to content

Commit

Permalink
Merge a50bad8 into a4706c0
Browse files Browse the repository at this point in the history
  • Loading branch information
vprithvi committed May 15, 2018
2 parents a4706c0 + a50bad8 commit f2b796e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
9 changes: 0 additions & 9 deletions plugin/storage/cassandra/dependencystore/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,3 @@ func (s *DependencyStore) GetDependencies(endTs time.Time, lookback time.Duratio
}
return mDependency, nil
}

func (s *DependencyStore) timeIntervalToPoints(endTs time.Time, lookback time.Duration) []time.Time {
startTs := endTs.Add(-lookback)
var days []time.Time
for day := endTs; startTs.Before(day); day = day.Add(-s.dependencyDataFrequency) {
days = append(days, day.Truncate(s.dependencyDataFrequency))
}
return days
}
22 changes: 0 additions & 22 deletions plugin/storage/cassandra/dependencystore/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,28 +192,6 @@ func TestDependencyStoreGetDependencies(t *testing.T) {
}
}

func TestDependencyStoreTimeIntervalToPoints(t *testing.T) {
withDepStore(func(s *depStorageTest) {
for _, truncate := range []bool{false, true} {
endTs := time.Date(2017, time.January, 24, 11, 15, 17, 12345, time.UTC)
if truncate {
endTs = endTs.Truncate(s.storage.dependencyDataFrequency)
}
// Look back 3 time intervals
lookback := 3 * s.storage.dependencyDataFrequency
points := s.storage.timeIntervalToPoints(endTs, lookback)
point := func(day int) time.Time {
return time.Date(2017, time.January, day, 0, 0, 0, 0, time.UTC)
}
assert.Equal(t, []time.Time{
point(24),
point(23),
point(22),
}, points, "Expecting 3 data points")
}
})
}

func matchEverything() interface{} {
return mock.MatchedBy(func(v []interface{}) bool { return true })
}

0 comments on commit f2b796e

Please sign in to comment.