@@ -38,31 +38,27 @@ func TestUpdateMetrics_MetricsDoNotExpire(t *testing.T) {
38
38
closeFunc := metricsAggregator .Run (ctx )
39
39
t .Cleanup (closeFunc )
40
40
41
- given := []agentsdk.AgentMetric {
42
- {
43
- Name : "a_counter_one" ,
44
- Type : agentsdk .AgentMetricTypeCounter ,
45
- Value : 1 ,
46
- },
47
- {
48
- Name : "b_counter_two" ,
49
- Type : agentsdk .AgentMetricTypeCounter ,
50
- Value : 2 ,
51
- },
52
- {
53
- Name : "c_gauge_three" ,
54
- Type : agentsdk .AgentMetricTypeCounter ,
55
- Value : 3 ,
56
- },
57
- {
58
- Name : "d_gauge_four" ,
59
- Type : agentsdk .AgentMetricTypeCounter ,
60
- Value : 4 ,
61
- },
41
+ given1 := []agentsdk.AgentMetric {
42
+ {Name : "a_counter_one" , Type : agentsdk .AgentMetricTypeCounter , Value : 1 },
43
+ {Name : "b_gauge_three" , Type : agentsdk .AgentMetricTypeCounter , Value : 2 },
44
+ {Name : "c_gauge_four" , Type : agentsdk .AgentMetricTypeCounter , Value : 3 },
45
+ }
46
+
47
+ given2 := []agentsdk.AgentMetric {
48
+ {Name : "b_gauge_three" , Type : agentsdk .AgentMetricTypeCounter , Value : 4 },
49
+ {Name : "d_gauge_four" , Type : agentsdk .AgentMetricTypeCounter , Value : 6 },
50
+ }
51
+
52
+ expected := []agentsdk.AgentMetric {
53
+ {Name : "a_counter_one" , Type : agentsdk .AgentMetricTypeCounter , Value : 1 },
54
+ {Name : "b_gauge_three" , Type : agentsdk .AgentMetricTypeCounter , Value : 4 },
55
+ {Name : "c_gauge_four" , Type : agentsdk .AgentMetricTypeCounter , Value : 3 },
56
+ {Name : "d_gauge_four" , Type : agentsdk .AgentMetricTypeCounter , Value : 6 },
62
57
}
63
58
64
59
// when
65
- metricsAggregator .Update (ctx , testUsername , testWorkspaceName , testAgentName , given )
60
+ metricsAggregator .Update (ctx , testUsername , testWorkspaceName , testAgentName , given1 )
61
+ metricsAggregator .Update (ctx , testUsername , testWorkspaceName , testAgentName , given2 )
66
62
67
63
// then
68
64
require .Eventually (t , func () bool {
@@ -74,7 +70,7 @@ func TestUpdateMetrics_MetricsDoNotExpire(t *testing.T) {
74
70
}
75
71
}()
76
72
metricsAggregator .Collect (metricsCh )
77
- return verifyCollectedMetrics (t , given , actual )
73
+ return verifyCollectedMetrics (t , expected , actual )
78
74
}, testutil .WaitMedium , testutil .IntervalFast )
79
75
}
80
76
0 commit comments