@@ -1015,8 +1015,8 @@ func TestUserMetrics(t *testing.T) {
10151015
10161016 mustDirect (t , t .Logf , lc1 , lc2 )
10171017
1018- // 10 megabytes
1019- bytesToSend := 10 * 1024 * 1024
1018+ // 1 megabytes
1019+ bytesToSend := 1 * 1024 * 1024
10201020
10211021 // This asserts generates some traffic, it is factored out
10221022 // of TestUDPConn.
@@ -1059,14 +1059,13 @@ func TestUserMetrics(t *testing.T) {
10591059 t .Errorf ("metrics1, tailscaled_approved_routes: got %v, want %v" , got , want )
10601060 }
10611061
1062- // Verify that the amount of data recorded in bytes is higher or equal to the
1063- // 10 megabytes sent.
1062+ // Verify that the amount of data recorded in bytes is higher or equal to the data sent
10641063 inboundBytes1 := parsedMetrics1 [`tailscaled_inbound_bytes_total{path="direct_ipv4"}` ]
10651064 if inboundBytes1 < float64 (bytesToSend ) {
10661065 t .Errorf (`metrics1, tailscaled_inbound_bytes_total{path="direct_ipv4"}: expected higher (or equal) than %d, got: %f` , bytesToSend , inboundBytes1 )
10671066 }
10681067
1069- // But ensure that it is not too much higher than the 10 megabytes sent.
1068+ // But ensure that it is not too much higher than the data sent.
10701069 if inboundBytes1 > float64 (bytesToSend )* bytesSentTolerance {
10711070 t .Errorf (`metrics1, tailscaled_inbound_bytes_total{path="direct_ipv4"}: expected lower than %f, got: %f` , float64 (bytesToSend )* bytesSentTolerance , inboundBytes1 )
10721071 }
@@ -1093,14 +1092,13 @@ func TestUserMetrics(t *testing.T) {
10931092 t .Errorf ("metrics2, tailscaled_approved_routes: got %v, want %v" , got , want )
10941093 }
10951094
1096- // Verify that the amount of data recorded in bytes is higher or equal than the
1097- // 10 megabytes sent.
1095+ // Verify that the amount of data recorded in bytes is higher or equal than the data sent.
10981096 outboundBytes2 := parsedMetrics2 [`tailscaled_outbound_bytes_total{path="direct_ipv4"}` ]
10991097 if outboundBytes2 < float64 (bytesToSend ) {
11001098 t .Errorf (`metrics2, tailscaled_outbound_bytes_total{path="direct_ipv4"}: expected higher (or equal) than %d, got: %f` , bytesToSend , outboundBytes2 )
11011099 }
11021100
1103- // But ensure that it is not too much higher than the 10 megabytes sent.
1101+ // But ensure that it is not too much higher than the data sent.
11041102 if outboundBytes2 > float64 (bytesToSend )* bytesSentTolerance {
11051103 t .Errorf (`metrics2, tailscaled_outbound_bytes_total{path="direct_ipv4"}: expected lower than %f, got: %f` , float64 (bytesToSend )* bytesSentTolerance , outboundBytes2 )
11061104 }
0 commit comments