Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase waiting time in test #1504

Merged
merged 1 commit into from Feb 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 13 additions & 13 deletions variation_test.go
Expand Up @@ -333,7 +333,7 @@ func TestBoolVariation(t *testing.T) {
got, err := BoolVariation(tt.args.flagKey, tt.args.user, tt.args.defaultValue)

if tt.expectedLog != "" {
time.Sleep(20 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
time.Sleep(40 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
content, _ := os.ReadFile(file.Name())
assert.Regexp(t, tt.expectedLog, string(content))
}
Expand Down Expand Up @@ -719,7 +719,7 @@ func TestBoolVariationDetails(t *testing.T) {
got, err := BoolVariationDetails(tt.args.flagKey, tt.args.user, tt.args.defaultValue)

if tt.expectedLog != "" {
time.Sleep(20 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
time.Sleep(40 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
content, _ := os.ReadFile(file.Name())
assert.Regexp(t, tt.expectedLog, string(content))
}
Expand Down Expand Up @@ -1014,7 +1014,7 @@ func TestFloat64Variation(t *testing.T) {
got, err := Float64Variation(tt.args.flagKey, tt.args.user, tt.args.defaultValue)

if tt.expectedLog != "" {
time.Sleep(20 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
time.Sleep(40 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
content, _ := os.ReadFile(file.Name())
assert.Regexp(t, tt.expectedLog, string(content))
}
Expand Down Expand Up @@ -1318,7 +1318,7 @@ func TestFloat64VariationDetails(t *testing.T) {
got, err := Float64VariationDetails(tt.args.flagKey, tt.args.user, tt.args.defaultValue)

if tt.expectedLog != "" {
time.Sleep(20 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
time.Sleep(40 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
content, _ := os.ReadFile(file.Name())
assert.Regexp(t, tt.expectedLog, string(content))
}
Expand Down Expand Up @@ -1600,7 +1600,7 @@ func TestJSONArrayVariation(t *testing.T) {
}
assert.Equal(t, tt.want, got, "JSONArrayVariation() got = %v, want %v", got, tt.want)
if tt.expectedLog != "" {
time.Sleep(20 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
time.Sleep(40 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
content, _ := os.ReadFile(file.Name())
assert.Regexp(t, tt.expectedLog, string(content))
}
Expand Down Expand Up @@ -1890,7 +1890,7 @@ func TestJSONArrayVariationDetails(t *testing.T) {
}
assert.Equal(t, tt.want, got, "JSONArrayVariation() got = %v, want %v", got, tt.want)
if tt.expectedLog != "" {
time.Sleep(20 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
time.Sleep(40 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
content, _ := os.ReadFile(file.Name())
assert.Regexp(t, tt.expectedLog, string(content))
}
Expand Down Expand Up @@ -2145,7 +2145,7 @@ func TestJSONVariation(t *testing.T) {
got, err := JSONVariation(tt.args.flagKey, tt.args.user, tt.args.defaultValue)

if tt.expectedLog != "" {
time.Sleep(20 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
time.Sleep(40 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
content, _ := os.ReadFile(file.Name())
assert.Regexp(t, tt.expectedLog, string(content))
}
Expand Down Expand Up @@ -2371,7 +2371,7 @@ func TestJSONVariationDetails(t *testing.T) {
got, err := JSONVariationDetails(tt.args.flagKey, tt.args.user, tt.args.defaultValue)

if tt.expectedLog != "" {
time.Sleep(20 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
time.Sleep(40 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
content, _ := os.ReadFile(file.Name())
assert.Regexp(t, tt.expectedLog, string(content))
}
Expand Down Expand Up @@ -2633,7 +2633,7 @@ func TestStringVariation(t *testing.T) {
got, err := StringVariation(tt.args.flagKey, tt.args.user, tt.args.defaultValue)

if tt.expectedLog != "" {
time.Sleep(20 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
time.Sleep(40 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
content, _ := os.ReadFile(file.Name())
assert.Regexp(t, tt.expectedLog, string(content))
}
Expand Down Expand Up @@ -2858,7 +2858,7 @@ func TestStringVariationDetails(t *testing.T) {
got, err := StringVariationDetails(tt.args.flagKey, tt.args.user, tt.args.defaultValue)

if tt.expectedLog != "" {
time.Sleep(20 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
time.Sleep(40 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
content, _ := os.ReadFile(file.Name())
assert.Regexp(t, tt.expectedLog, string(content))
}
Expand Down Expand Up @@ -3151,7 +3151,7 @@ func TestIntVariation(t *testing.T) {
got, err := IntVariation(tt.args.flagKey, tt.args.user, tt.args.defaultValue)

if tt.expectedLog != "" {
time.Sleep(20 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
time.Sleep(40 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
content, _ := os.ReadFile(file.Name())
assert.Regexp(t, tt.expectedLog, string(content))
}
Expand Down Expand Up @@ -3418,7 +3418,7 @@ func TestIntVariationDetails(t *testing.T) {
got, err := IntVariationDetails(tt.args.flagKey, tt.args.user, tt.args.defaultValue)

if tt.expectedLog != "" {
time.Sleep(20 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
time.Sleep(40 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
content, _ := os.ReadFile(file.Name())
assert.Regexp(t, tt.expectedLog, string(content))
}
Expand Down Expand Up @@ -3929,7 +3929,7 @@ func TestRawVariation(t *testing.T) {
got, err := ff.RawVariation(tt.args.flagKey, tt.args.user, tt.args.defaultValue)

if tt.expectedLog != "" {
time.Sleep(20 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
time.Sleep(40 * time.Millisecond) // since the log is async, we are waiting to be sure it's written
content, _ := os.ReadFile(file.Name())
assert.Regexp(t, tt.expectedLog, string(content))
}
Expand Down