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

Fix logging integration test failure on when running on GCE #3641

Merged
merged 5 commits into from
Sep 5, 2018
Merged
Changes from 4 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
Expand Up @@ -16,6 +16,7 @@

package com.google.cloud.logging;

import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
Expand All @@ -36,12 +37,11 @@
import com.google.common.collect.Iterators;
import com.google.common.collect.Sets;
import com.google.logging.v2.LogName;
import com.google.logging.v2.ProjectLogName;
import java.util.Iterator;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.google.logging.v2.ProjectLogName;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
Expand Down Expand Up @@ -312,9 +312,11 @@ public void testLoggingHandler() throws InterruptedException {
assertEquals(logId, entry.getLogName());
assertEquals(ImmutableMap.of("levelName", "INFO",

This comment was marked as spam.

"levelValue", String.valueOf(Level.INFO.intValue())), entry.getLabels());
assertEquals("global", entry.getResource().getType());
assertEquals(ImmutableMap.of("project_id", options.getProjectId()),
entry.getResource().getLabels());
MonitoredResource monitoredResource =
new LoggingConfig(handler.getClass().getName())
.getMonitoredResource(options.getProjectId());
assertThat(entry.getResource().getType()).isEqualTo(monitoredResource.getType());
assertThat(entry.getResource().getLabels()).containsEntry("project_id", options.getProjectId());
assertNull(entry.getHttpRequest());
assertEquals(Severity.INFO, entry.getSeverity());
assertNull(entry.getOperation());
Expand Down