Skip to content

Commit

Permalink
Make prometheus provider always add a finishAt time
Browse files Browse the repository at this point in the history
  • Loading branch information
dthomson25 committed Sep 28, 2019
1 parent b2bb237 commit 77f87e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions providers/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,8 @@ func (p *Provider) Run(metric v1alpha1.Metric, args []v1alpha1.Argument) (v1alph
newMeasurement.Value = newValue

newMeasurement.Status = newStatus
// if newStatus.Completed() {
// finishedTime := metav1.Now()
// p.measurement.FinishedAt = &finishedTime
// }
finishedTime := metav1.Now()
newMeasurement.FinishedAt = &finishedTime
return newMeasurement, nil
}

Expand Down
6 changes: 3 additions & 3 deletions providers/prometheus/prometheus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestType(t *testing.T) {
assert.Equal(t, ProviderType, p.Type())
}

func TestRunSuccessFully(t *testing.T) {
func TestRunSuccessfully(t *testing.T) {
e := log.Entry{}
mock := mockAPI{
value: newScalar(10),
Expand All @@ -48,8 +48,8 @@ func TestRunSuccessFully(t *testing.T) {
assert.Nil(t, err)
assert.NotNil(t, measurement.StartedAt)
assert.Equal(t, "10", measurement.Value)
// assert.NotNil(t, measurement.FinishedAt)
// assert.Equal(t, v1alpha1.AnalysisStatusSuccessful, measurement.Status)
assert.NotNil(t, measurement.FinishedAt)
assert.Equal(t, v1alpha1.AnalysisStatusSuccessful, measurement.Status)
}

func TestRunWithQueryError(t *testing.T) {
Expand Down

0 comments on commit 77f87e5

Please sign in to comment.