Skip to content

Commit e12ec91

Browse files
fix tests
1 parent 9ff1a7b commit e12ec91

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

internal/openmetrics-exporter/volume_groups_collector_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"testing"
1313
)
1414

15-
func TestVolumesSpaceCollector(t *testing.T) {
15+
func TestVolumesGroupSpaceCollector(t *testing.T) {
1616
res, _ := os.ReadFile("../../test/data/volume_groups.json")
1717
vers, _ := os.ReadFile("../../test/data/versions.json")
1818
var volumeGroups client.VolumeGroupsList
@@ -34,14 +34,14 @@ func TestVolumesSpaceCollector(t *testing.T) {
3434
want := make(map[string]bool)
3535
for _, vg := range volumeGroups.Items {
3636
if vg.QoS.BandwidthLimit != nil {
37-
want[fmt.Sprintf("label:{name:\"name\" value:\"%s\"} gauge:{value:%g}", vg.Name, float64(*v.QoS.BandwidthLimit))] = true
37+
want[fmt.Sprintf("label:{name:\"name\" value:\"%s\"} gauge:{value:%g}", vg.Name, float64(*vg.QoS.BandwidthLimit))] = true
3838
}
3939
if vg.QoS.IopsLimit != nil {
40-
want[fmt.Sprintf("label:{name:\"name\" value:\"%s\"} gauge:{value:%g}", vg.Name, float64(*v.QoS.IopsLimit))] = true
40+
want[fmt.Sprintf("label:{name:\"name\" value:\"%s\"} gauge:{value:%g}", vg.Name, float64(*vg.QoS.IopsLimit))] = true
4141
}
4242
}
4343
defer server.Close()
44-
c := client.NewRestClient(e, "fake-api-token", "latest", "test-user-agent-string", "test-X-Request-Id-string", false)
44+
c := client.NewRestClient(e, "fake-api-token", "latest", "test-user-agent-string", "test-X-Request-Id-string", false, false)
4545
vgc := NewVolumeGroupsCollector(c)
4646
metricsCheck(t, vgc, want)
4747
}

internal/openmetrics-exporter/volume_groups_performance_collector_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
client "purestorage/fa-openmetrics-exporter/internal/rest-client"
1414
)
1515

16-
func TestVolumesPerformanceCollector(t *testing.T) {
16+
func TestVolumesGroupPerformanceCollector(t *testing.T) {
1717
ref, _ := os.ReadFile("../../test/data/volume_groups_performance.json")
1818
vers, _ := os.ReadFile("../../test/data/versions.json")
1919
var volumegroupsperf client.VolumeGroupsPerformanceList
@@ -24,10 +24,10 @@ func TestVolumesPerformanceCollector(t *testing.T) {
2424
w.Header().Set("Content-Type", "application/json")
2525
w.WriteHeader(http.StatusOK)
2626
w.Write([]byte(vers))
27-
} else if vperfu.MatchString(r.URL.Path) {
27+
} else if vgperfu.MatchString(r.URL.Path) {
2828
w.Header().Set("Content-Type", "application/json")
2929
w.WriteHeader(http.StatusOK)
30-
w.Write([]byte(volsperf))
30+
w.Write([]byte(ref))
3131
}
3232
}))
3333
endp := strings.Split(server.URL, "/")
@@ -62,8 +62,8 @@ func TestVolumesPerformanceCollector(t *testing.T) {
6262
want[fmt.Sprintf("label:{name:\"dimension\" value:\"bytes_per_read\"} label:{name:\"name\" value:\"%s\"} gauge:{value:%g}", p.Name, p.BytesPerRead)] = true
6363
want[fmt.Sprintf("label:{name:\"dimension\" value:\"bytes_per_write\"} label:{name:\"name\" value:\"%s\"} gauge:{value:%g}", p.Name, p.BytesPerWrite)] = true
6464
}
65-
c := client.NewRestClient(e, "fake-api-token", "latest", "test-user-agent-string", "test-X-Request-Id-string", false)
65+
c := client.NewRestClient(e, "fake-api-token", "latest", "test-user-agent-string", "test-X-Request-Id-string", false, false)
6666

67-
vgpc := NewVolumeGroupsPerformanceCollector(c, vl)
67+
vgpc := NewVolumeGroupsPerformanceCollector(c)
6868
metricsCheck(t, vgpc, want)
6969
}

internal/rest-client/volume_groups_performance_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func TestVolumeGroupsPerformance(t *testing.T) {
3434
e := endp[len(endp)-1]
3535
t.Run("volume_groups_performance_1", func(t *testing.T) {
3636
defer server.Close()
37-
c := NewRestClient(e, "fake-api-token", "latest", "test-user-agent-string", "test-X-Request-Id-string", false)
37+
c := NewRestClient(e, "fake-api-token", "latest", "test-user-agent-string", "test-X-Request-Id-string", false, false)
3838
vgpl := c.GetVolumeGroupsPerformance()
3939
if diff := cmp.Diff(vgpl.Items, vgroupsp.Items); diff != "" {
4040
t.Errorf("Mismatch (-want +got):\n%s", diff)

internal/rest-client/volume_groups_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func TestVolumeGroups(t *testing.T) {
3434
e := endp[len(endp)-1]
3535
t.Run("volume_group_1", func(t *testing.T) {
3636
defer server.Close()
37-
c := NewRestClient(e, "fake-api-token", "latest", "test-user-agent-string", "test-X-Request-Id-string", false)
37+
c := NewRestClient(e, "fake-api-token", "latest", "test-user-agent-string", "test-X-Request-Id-string", false, false)
3838
vgl := c.GetVolumeGroups()
3939
if diff := cmp.Diff(vgl.Items, vgs.Items); diff != "" {
4040
t.Errorf("Mismatch (-want +got):\n%s", diff)

0 commit comments

Comments
 (0)