You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by zentol <gi...@git.apache.org> on 2017/05/03 09:14:11 UTC

[GitHub] flink pull request #3736: [FLINK-6013][metrics] Add Datadog HTTP metrics rep...

Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3736#discussion_r114501062
  
    --- Diff: flink-metrics/flink-metrics-datadog/src/test/java/org/apache/flink/metrics/datadog/DatadogHttpClientTest.java ---
    @@ -0,0 +1,194 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.flink.metrics.datadog;
    +
    +import com.fasterxml.jackson.core.JsonProcessingException;
    +import org.apache.flink.metrics.Counter;
    +import org.apache.flink.metrics.Gauge;
    +import org.apache.flink.metrics.Meter;
    +import org.junit.Before;
    +import org.junit.Test;
    +import org.junit.experimental.runners.Enclosed;
    +import org.junit.runner.RunWith;
    +import org.powermock.api.mockito.PowerMockito;
    +import org.powermock.core.classloader.annotations.PrepareForTest;
    +import org.powermock.modules.junit4.PowerMockRunner;
    +
    +import java.util.Arrays;
    +import java.util.List;
    +
    +import static org.junit.Assert.assertEquals;
    +
    +@RunWith(Enclosed.class)
    +public class DatadogHttpClientTest {
    +	public static class TestApiKey {
    +		@Test(expected = IllegalArgumentException.class)
    +		public void testValidateApiKey() {
    +			new DatadogHttpClient("fake_key");
    --- End diff --
    
    This always sends a request to the Datadog servers correct? I'm a bit skeptical since this means if the servers are down we end up with a failing test. In general though, throwing out requests at them even though we know they will fail anyway doesn't seem ehhh.... nice?
    
    Just checking that it fails when supplying null or an empty string is enough.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---