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

Fixed flakiness of attemptToSendReset test, re-enabled the test suite #21

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package net.openhft.chronicle.analytics.internal;

import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Disabled;
import org.junit.Assume;
import org.junit.jupiter.api.Test;

import java.time.LocalTime;
Expand All @@ -13,7 +13,7 @@
import static net.openhft.chronicle.analytics.internal.FilesUtil.removeLastUsedFileTimeStampSecond;
import static org.junit.jupiter.api.Assertions.*;

@Disabled(/* failing test https://teamcity.chronicle.software/buildConfiguration/Chronicle_BuildAll_Build/677499?hideProblemsFromDependencies=false&hideTestsFromDependencies=false&expandBuildChangesSection=true&expandBuildTestsSection=true */)
//@Disabled(/* failing test https://teamcity.chronicle.software/buildConfiguration/Chronicle_BuildAll_Build/677499?hideProblemsFromDependencies=false&hideTestsFromDependencies=false&expandBuildChangesSection=true&expandBuildTestsSection=true */)
final class GoogleAnalyticsTest {

@Test
Expand Down Expand Up @@ -80,15 +80,16 @@ void attemptToSendReset() {
final int messages = 5;
final TimeUnit timeUnit = TimeUnit.SECONDS;
final long duration = 1;

removeLastUsedFileTimeStampSecond();
final GoogleAnalytics4 googleAnalytics = (GoogleAnalytics4) new VanillaAnalyticsBuilder("", "")
.withFrequencyLimit(messages, duration, timeUnit)
.withReportDespiteJUnit()
.build();

assertFalse(googleAnalytics.muted, "The instance is muted!");

/* This test would fail if run concurrently from two different JVMs,
therefore it's only run if the googleAnalytics instance is not muted (update in agreement with Rob)
*/
Assume.assumeFalse(googleAnalytics.muted);
for (int i = 0; i < messages; i++) {
assertTrue(googleAnalytics.attemptToSend(), "Round " + i);
}
Expand Down