Skip to content

Commit d822e36

Browse files
author
mervynwang
committed
modify go.yaml && fix unit test
1 parent 0eeaee6 commit d822e36

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

.github/workflows/go.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@ jobs:
2929

3030
# Cache go build cache, used to speedup go test
3131
- name: Go Build Cache
32-
uses: actions/cache@v2
32+
uses: actions/cache@v3
3333
with:
3434
path: ${{ steps.go-cache-paths.outputs.go-build }}
3535
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
3636

3737
# Cache go mod cache, used to speedup builds
3838
- name: Go Mod Cache
39-
uses: actions/cache@v2
39+
uses: actions/cache@v3
4040
with:
4141
path: ${{ steps.go-cache-paths.outputs.go-mod }}
4242
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
4343

4444
- name: Go Lint Cache
45-
uses: actions/cache@v2
45+
uses: actions/cache@v3
4646
with:
4747
path: |
4848
~/.cache/golangci-lint
@@ -66,7 +66,7 @@ jobs:
6666
sed -i 's/black/whitesmoke/g' coverage.html
6767
6868
- name: Upload a Build Artifact
69-
uses: actions/upload-artifact@v3.0.0
69+
uses: actions/upload-artifact@v4
7070
with:
7171
# Artifact name
7272
name: coverage.html # optional, default is artifact
@@ -92,14 +92,14 @@ jobs:
9292
9393
# Cache go build cache, used to speedup go test
9494
- name: Go Build Cache
95-
uses: actions/cache@v2
95+
uses: actions/cache@v3
9696
with:
9797
path: ${{ steps.go-cache-paths.outputs.go-build }}
9898
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
9999

100100
# Cache go mod cache, used to speedup builds
101101
- name: Go Mod Cache
102-
uses: actions/cache@v2
102+
uses: actions/cache@v3
103103
with:
104104
path: ${{ steps.go-cache-paths.outputs.go-mod }}
105105
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
@@ -125,14 +125,14 @@ jobs:
125125
126126
# Cache go build cache, used to speedup go test
127127
- name: Go Build Cache
128-
uses: actions/cache@v2
128+
uses: actions/cache@v3
129129
with:
130130
path: ${{ steps.go-cache-paths.outputs.go-build }}
131131
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
132132

133133
# Cache go mod cache, used to speedup builds
134134
- name: Go Mod Cache
135-
uses: actions/cache@v2
135+
uses: actions/cache@v3
136136
with:
137137
path: ${{ steps.go-cache-paths.outputs.go-mod }}
138138
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
@@ -158,14 +158,14 @@ jobs:
158158
159159
# Cache go build cache, used to speedup go test
160160
- name: Go Build Cache
161-
uses: actions/cache@v2
161+
uses: actions/cache@v3
162162
with:
163163
path: ${{ steps.go-cache-paths.outputs.go-build }}
164164
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
165165

166166
# Cache go mod cache, used to speedup builds
167167
- name: Go Mod Cache
168-
uses: actions/cache@v2
168+
uses: actions/cache@v3
169169
with:
170170
path: ${{ steps.go-cache-paths.outputs.go-mod }}
171171
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}

pkg/utils/expression_prom_deafult_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func TestGetPodCpuUsageExpression(t *testing.T) {
144144
description: "GetPodCpuUsageExpression",
145145
namespace: "default",
146146
name: "test-pod-001",
147-
expect: "sum(irate(container_cpu_usage_seconds_total{container!=\"POD\",namespace=\"default\",pod=\"test-pod-001\"}[3m]))",
147+
expect: "sum(irate(pod_cpu_seconds_total{mode!~\"idle|iowait\",namespace=\"default\",pod=\"test-pod-001\"}[3m]))",
148148
}
149149

150150
requests := GetPodCpuUsageExpression(test.namespace, test.name)
@@ -163,7 +163,7 @@ func TestGetPodMemUsageExpression(t *testing.T) {
163163
description: "GetPodMemUsageExpression",
164164
namespace: "default",
165165
name: "test-pod-001",
166-
expect: "sum(container_memory_working_set_bytes{container!=\"POD\",namespace=\"default\",pod=\"test-pod-001\"})",
166+
expect: "pod_memory_MemTotal_bytes{namespace=\"default\",pod=\"test-pod-001\"} - pod_memory_MemFree_bytes{namespace=\"default\",pod=\"test-pod-001\"}",
167167
}
168168

169169
requests := GetPodMemUsageExpression(test.namespace, test.name)

0 commit comments

Comments
 (0)