Skip to content

Commit

Permalink
Delete gaugeMetadata tests that correctly fail
Browse files Browse the repository at this point in the history
  • Loading branch information
tejasd committed Feb 6, 2025
1 parent 148b068 commit 705ceea
Showing 1 changed file with 0 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,20 +136,6 @@ public void testOnUpdateAppStateGeneratesNewSessionIdOnBackgroundStateIfPerfSess
assertThat(oldSessionId).isNotEqualTo(testSessionManager.perfSession().sessionId());
}

@Test
public void
testOnUpdateAppStateMakesGaugeManagerLogGaugeMetadataOnForegroundStateIfSessionIsVerbose() {
forceVerboseSession();

SessionManager testSessionManager =
new SessionManager(mockGaugeManager, mockPerfSession, mockAppStateMonitor);
testSessionManager.onUpdateAppState(ApplicationProcessState.FOREGROUND);

verify(mockGaugeManager)
.logGaugeMetadata(
anyString(), nullable(com.google.firebase.perf.v1.ApplicationProcessState.class));
}

@Test
public void
testOnUpdateAppStateDoesntMakeGaugeManagerLogGaugeMetadataOnForegroundStateIfSessionIsNonVerbose() {
Expand Down Expand Up @@ -178,21 +164,6 @@ public void testOnUpdateAppStateGeneratesNewSessionIdOnBackgroundStateIfPerfSess
anyString(), nullable(com.google.firebase.perf.v1.ApplicationProcessState.class));
}

@Test
public void
testOnUpdateAppStateMakesGaugeManagerLogGaugeMetadataOnBackgroundAppStateIfSessionIsVerboseAndTimedOut() {
when(mockPerfSession.isSessionRunningTooLong()).thenReturn(true);
forceVerboseSession();

SessionManager testSessionManager =
new SessionManager(mockGaugeManager, mockPerfSession, mockAppStateMonitor);
testSessionManager.onUpdateAppState(ApplicationProcessState.BACKGROUND);

verify(mockGaugeManager)
.logGaugeMetadata(
anyString(), nullable(com.google.firebase.perf.v1.ApplicationProcessState.class));
}

@Test
public void testOnUpdateAppStateMakesGaugeManagerStartCollectingGaugesIfSessionIsVerbose() {
forceVerboseSession();
Expand Down Expand Up @@ -232,32 +203,6 @@ public void testOnUpdateAppStateMakesGaugeManagerStopCollectingGaugesWhenSession
verify(mockGaugeManager).stopCollectingGauges();
}

@Test
public void testGaugeMetadataIsFlushedOnlyWhenNewVerboseSessionIsCreated() {
when(mockPerfSession.isSessionRunningTooLong()).thenReturn(false);

// Start with a non verbose session
forceNonVerboseSession();
SessionManager testSessionManager =
new SessionManager(
mockGaugeManager, PerfSession.createWithId("testSessionId1"), mockAppStateMonitor);

verify(mockGaugeManager, times(0))
.logGaugeMetadata(
eq("testSessionId1"),
eq(com.google.firebase.perf.v1.ApplicationProcessState.FOREGROUND));

// Forcing a verbose session will enable Gauge collection
forceVerboseSession();
testSessionManager.updatePerfSession(PerfSession.createWithId("testSessionId2"));
verify(mockGaugeManager, times(1)).logGaugeMetadata(eq("testSessionId2"), any());

// Force a non-verbose session and verify if we are not logging metadata
forceVerboseSession();
testSessionManager.updatePerfSession(PerfSession.createWithId("testSessionId3"));
verify(mockGaugeManager, times(1)).logGaugeMetadata(eq("testSessionId3"), any());
}

@Test
public void testSessionIdDoesNotUpdateIfPerfSessionRunsTooLong() {
Timer mockTimer = mock(Timer.class);
Expand Down

0 comments on commit 705ceea

Please sign in to comment.