Skip to content

Commit b22e261

Browse files
committed
Testing more interesting cases of Prometheus usage
Signed-off-by: Ziv Nevo <[email protected]>
1 parent e5e8f62 commit b22e261

File tree

4 files changed

+45
-1
lines changed

4 files changed

+45
-1
lines changed

pkg/analyzer/policies_synthesizer_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ func TestExtractConnectionsCustomWalk2(t *testing.T) {
230230
synthesizer := NewPoliciesSynthesizer(WithWalkFn(filepath.WalkDir))
231231
resources, conns, errs := synthesizer.extractConnectionsFromFolderPaths([]string{dirPath})
232232
require.Len(t, errs, 0)
233-
require.Len(t, conns, 14)
233+
require.Len(t, conns, 15)
234234
require.Len(t, resources, 14)
235235
}
236236

tests/sockshop/expected_netpol_output.json

+36
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
{
2424
"protocol": "TCP",
2525
"port": 80
26+
},
27+
{
28+
"protocol": "TCP",
29+
"port": 9090
2630
}
2731
],
2832
"from": [
@@ -34,6 +38,19 @@
3438
}
3539
}
3640
]
41+
},
42+
{
43+
"ports": [
44+
{
45+
"protocol": "TCP",
46+
"port": 9090
47+
}
48+
],
49+
"from": [
50+
{
51+
"namespaceSelector": {}
52+
}
53+
]
3754
}
3855
],
3956
"egress": [
@@ -203,6 +220,10 @@
203220
{
204221
"protocol": "TCP",
205222
"port": 80
223+
},
224+
{
225+
"protocol": "TCP",
226+
"port": 9090
206227
}
207228
],
208229
"to": [
@@ -384,6 +405,21 @@
384405
"name": "user"
385406
}
386407
},
408+
"ingress": [
409+
{
410+
"ports": [
411+
{
412+
"protocol": "TCP",
413+
"port": 7070
414+
}
415+
],
416+
"from": [
417+
{
418+
"namespaceSelector": {}
419+
}
420+
]
421+
}
422+
],
387423
"egress": [
388424
{
389425
"ports": [

tests/sockshop/manifests/02-carts-svc.yml

+3
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ spec:
1313
# the port that this service should serve on
1414
- port: 80
1515
targetPort: 80
16+
- port: 9090
17+
name: exporter
18+
protocol: TCP
1619
selector:
1720
name: carts

tests/sockshop/manifests/26-user-svc.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,19 @@ metadata:
55
name: user
66
annotations:
77
prometheus.io/scrape: 'true'
8+
prometheus.io/port: '7070'
89
labels:
910
name: user
1011
namespace: sock-shop
1112
spec:
1213
ports:
1314
# the port that this service should serve on
1415
- port: 80
16+
name: http
1517
targetPort: 80
18+
- port: 7070
19+
name: metrics
20+
targetPort: 7070
1621
selector:
1722
name: user
1823

0 commit comments

Comments
 (0)