Skip to content

Commit

Permalink
Fix incorrect 'unexpected unique user log' failures
Browse files Browse the repository at this point in the history
  • Loading branch information
rod-hynes committed Dec 12, 2024
1 parent bca4fde commit 1f9a9a6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions psiphon/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -720,12 +720,10 @@ var (
testSteeringIP = "1.1.1.1"
)

var serverRuns = 0
var lastConnectedUpdateCount = 0

func runServer(t *testing.T, runConfig *runServerConfig) {

serverRuns += 1

psiphonServerIPAddress := "127.0.0.1"
psiphonServerPort := 4000

Expand Down Expand Up @@ -1487,7 +1485,7 @@ func runServer(t *testing.T, runConfig *runServerConfig) {

// Test unique user counting cases.
var expectUniqueUser bool
switch serverRuns % 3 {
switch lastConnectedUpdateCount % 3 {
case 0:
// Mock no last_connected.
psiphon.SetKeyValue("lastConnected", "")
Expand Down Expand Up @@ -1665,6 +1663,9 @@ func runServer(t *testing.T, runConfig *runServerConfig) {
}
waitOnNotification(t, tunnelsEstablished, timeoutSignal, "tunnel established timeout exceeded")
waitOnNotification(t, homepageReceived, timeoutSignal, "homepage received timeout exceeded")

// The tunnel connected, so the local last_connected has been updated.
lastConnectedUpdateCount += 1
}

if runConfig.doChangeBytesConfig {
Expand Down

0 comments on commit 1f9a9a6

Please sign in to comment.