Skip to content

Commit 214c7a5

Browse files
committed
metrics: read test-jsons from 'testdata' subdir
Code cleanup: moved input test JSON files into dedicated testdata sub-directory. Reduces code pollution. Signed-off-by: Shachar Sharon <[email protected]>
1 parent 4577a70 commit 214c7a5

File tree

9 files changed

+1770
-1781
lines changed

9 files changed

+1770
-1781
lines changed

internal/metrics/smbstatus_test.go

Lines changed: 25 additions & 1781 deletions
Large diffs are not rendered by default.
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
{
2+
"timestamp": "2022-04-15T18:25:15.364891+0200",
3+
"version": "4.17.0pre1-GIT-a0f12b9c80b",
4+
"smb_conf": "/opt/sambaTest/etc/smb.conf",
5+
"sessions": {
6+
"3639217376": {
7+
"session_id": "3639217376",
8+
"server_id": {
9+
"pid": "69650",
10+
"task_id": "0",
11+
"vnn": "4294967295",
12+
"unique_id": "10756714984493602300"
13+
},
14+
"uid": 1000,
15+
"gid": 1000,
16+
"username": "janger",
17+
"groupname": "janger",
18+
"remote_machine": "127.0.0.1",
19+
"hostname": "ipv4:127.0.0.1:59944",
20+
"session_dialect": "SMB3_11",
21+
"encryption": {
22+
"cipher": "",
23+
"degree": "none"
24+
},
25+
"signing": {
26+
"cipher": "AES-128-GMAC",
27+
"degree": "partial"
28+
}
29+
}
30+
},
31+
"tcons": {
32+
"3813255619": {
33+
"service": "gemeinsam",
34+
"server_id": {
35+
"pid": "69650",
36+
"task_id": "0",
37+
"vnn": "4294967295",
38+
"unique_id": "10756714984493602300"
39+
},
40+
"tcon_id": "3813255619",
41+
"session_id": "3639217376",
42+
"machine": "127.0.0.1",
43+
"connected_at": "2022-04-15T17:30:37+0200",
44+
"encryption": {
45+
"cipher": "AES-128-GMAC",
46+
"degree": "full"
47+
},
48+
"signing": {
49+
"cipher": "",
50+
"degree": "none"
51+
}
52+
}
53+
},
54+
"open_files": {
55+
"/home/janger/testfolder/hallo": {
56+
"service_path": "/home/janger/testfolder",
57+
"filename": "hallo",
58+
"fileid": {
59+
"devid": 59,
60+
"inode": 11404245,
61+
"extid": 0
62+
},
63+
"num_pending_deletes": 0,
64+
"opens": {
65+
"56839/2": {
66+
"server_id": {
67+
"pid": "69650",
68+
"task_id": "0",
69+
"vnn": "4294967295",
70+
"unique_id": "10756714984493602300"
71+
},
72+
"uid": 1000,
73+
"share_file_id": "2",
74+
"sharemode": {
75+
"hex": "0x00000003",
76+
"NONE": false,
77+
"READ": true,
78+
"WRITE": true,
79+
"DELETE": false,
80+
"text": "RW"
81+
},
82+
"access_mask": {
83+
"hex": "0x00000003",
84+
"READ_DATA": true,
85+
"WRITE_DATA": true,
86+
"APPEND_DATA": false,
87+
"READ_EA": false,
88+
"WRITE_EA": false,
89+
"EXECUTE": false,
90+
"READ_ATTRIBUTES": false,
91+
"WRITE_ATTRIBUTES": false,
92+
"DELETE_CHILD": false,
93+
"DELETE": false,
94+
"READ_CONTROL": false,
95+
"WRITE_DAC": false,
96+
"SYNCHRONIZE": false,
97+
"ACCESS_SYSTEM_SECURITY": false,
98+
"text": "RW"
99+
},
100+
"caching": {
101+
"READ": false,
102+
"WRITE": false,
103+
"HANDLE": false,
104+
"hex": "0x00000000",
105+
"text": ""
106+
},
107+
"oplock": {
108+
"EXCLUSIVE": false,
109+
"BATCH": false,
110+
"LEVEL_II": false,
111+
"LEASE": false,
112+
"text": "NONE"
113+
},
114+
"lease": {},
115+
"connected_at": "2022-04-15T17:30:38+0200"
116+
}
117+
}
118+
}
119+
}
120+
}
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
{
2+
"timestamp": "2022-07-20T12:07:36.225955+0000",
3+
"version": "4.17.0pre1-UNKNOWN",
4+
"smb_conf": "/etc/samba/smb.conf",
5+
"sessions": {},
6+
"tcons": {
7+
"348413079": {
8+
"service": "IPC$",
9+
"server_id": {
10+
"pid": "101",
11+
"task_id": "0",
12+
"vnn": "4294967295",
13+
"unique_id": "7364797719700910696"
14+
},
15+
"tcon_id": "348413079",
16+
"session_id": "674813472",
17+
"machine": "127.0.0.1",
18+
"connected_at": "2022-07-20T12:04:15+0000",
19+
"encryption": {
20+
"cipher": "",
21+
"degree": "none"
22+
},
23+
"signing": {
24+
"cipher": "",
25+
"degree": "none"
26+
}
27+
},
28+
"1698398697": {
29+
"service": "samba-share",
30+
"server_id": {
31+
"pid": "101",
32+
"task_id": "0",
33+
"vnn": "4294967295",
34+
"unique_id": "7364797719700910696"
35+
},
36+
"tcon_id": "1698398697",
37+
"session_id": "674813472",
38+
"machine": "127.0.0.1",
39+
"connected_at": "2022-07-20T12:04:15+0000",
40+
"encryption": {
41+
"cipher": "",
42+
"degree": "none"
43+
},
44+
"signing": {
45+
"cipher": "",
46+
"degree": "none"
47+
}
48+
}
49+
},
50+
"open_files": {
51+
"/mnt/96dd85fd-6c60-409c-bc1c-15f98eb358ee/a/y": {
52+
"service_path": "/mnt/96dd85fd-6c60-409c-bc1c-15f98eb358ee",
53+
"filename": "a/y",
54+
"fileid": {
55+
"devid": -397762331,
56+
"inode": 13631494,
57+
"extid": 0
58+
},
59+
"num_pending_deletes": 0,
60+
"opens": {
61+
"101/61": {
62+
"server_id": {
63+
"pid": "101",
64+
"task_id": "0",
65+
"vnn": "4294967295",
66+
"unique_id": "7364797719700910696"
67+
},
68+
"uid": 1000,
69+
"share_file_id": "61",
70+
"sharemode": {
71+
"hex": "0x00000007",
72+
"NONE": false,
73+
"READ": true,
74+
"WRITE": true,
75+
"DELETE": true,
76+
"text": "RWD"
77+
},
78+
"access_mask": {
79+
"hex": "0x0012019f",
80+
"READ_DATA": true,
81+
"WRITE_DATA": true,
82+
"APPEND_DATA": true,
83+
"READ_EA": true,
84+
"WRITE_EA": true,
85+
"EXECUTE": false,
86+
"READ_ATTRIBUTES": true,
87+
"WRITE_ATTRIBUTES": true,
88+
"DELETE_CHILD": false,
89+
"DELETE": false,
90+
"READ_CONTROL": true,
91+
"WRITE_DAC": false,
92+
"SYNCHRONIZE": true,
93+
"ACCESS_SYSTEM_SECURITY": false,
94+
"text": "RW"
95+
},
96+
"caching": {
97+
"READ": true,
98+
"WRITE": true,
99+
"HANDLE": true,
100+
"hex": "0x00000007",
101+
"text": "RWH"
102+
},
103+
"oplock": {
104+
"EXCLUSIVE": false,
105+
"BATCH": true,
106+
"LEVEL_II": false,
107+
"LEASE": false,
108+
"text": "BATCH"
109+
},
110+
"lease": {},
111+
"connected_at": "2022-07-20T12:06:29+0000"
112+
}
113+
}
114+
},
115+
"/mnt/96dd85fd-6c60-409c-bc1c-15f98eb358ee/a/x": {
116+
"service_path": "/mnt/96dd85fd-6c60-409c-bc1c-15f98eb358ee",
117+
"filename": "a/x",
118+
"fileid": {
119+
"devid": -397762331,
120+
"inode": 13631493,
121+
"extid": 0
122+
},
123+
"num_pending_deletes": 0,
124+
"opens": {
125+
"101/65": {
126+
"server_id": {
127+
"pid": "101",
128+
"task_id": "0",
129+
"vnn": "4294967295",
130+
"unique_id": "7364797719700910696"
131+
},
132+
"uid": 1000,
133+
"share_file_id": "65",
134+
"sharemode": {
135+
"hex": "0x00000007",
136+
"NONE": false,
137+
"READ": true,
138+
"WRITE": true,
139+
"DELETE": true,
140+
"text": "RWD"
141+
},
142+
"access_mask": {
143+
"hex": "0x0012019f",
144+
"READ_DATA": true,
145+
"WRITE_DATA": true,
146+
"APPEND_DATA": true,
147+
"READ_EA": true,
148+
"WRITE_EA": true,
149+
"EXECUTE": false,
150+
"READ_ATTRIBUTES": true,
151+
"WRITE_ATTRIBUTES": true,
152+
"DELETE_CHILD": false,
153+
"DELETE": false,
154+
"READ_CONTROL": true,
155+
"WRITE_DAC": false,
156+
"SYNCHRONIZE": true,
157+
"ACCESS_SYSTEM_SECURITY": false,
158+
"text": "RW"
159+
},
160+
"caching": {
161+
"READ": true,
162+
"WRITE": true,
163+
"HANDLE": true,
164+
"hex": "0x00000007",
165+
"text": "RWH"
166+
},
167+
"oplock": {
168+
"EXCLUSIVE": false,
169+
"BATCH": true,
170+
"LEVEL_II": false,
171+
"LEASE": true,
172+
"text": "BATCH"
173+
},
174+
"lease": {},
175+
"connected_at": "2022-07-20T12:06:42+0000"
176+
}
177+
}
178+
}
179+
}
180+
}

0 commit comments

Comments
 (0)