-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1012 from salesforce/srh-graphite-udp-bug-fix
@W-16736060 - support IP changes during runtime for graphite UDP repo…
- Loading branch information
Showing
3 changed files
with
86 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,3 +56,7 @@ publishing { | |
mavenLocal() | ||
} | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...porter/src/test/java/com/sfcc/um/metrics_reporter/transport/GraphiteUDPTransportTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* All rights reserved. | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
package com.sfcc.um.metrics_reporter.transport; | ||
|
||
import com.codahale.metrics.MetricRegistry; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.IOException; | ||
|
||
import static com.codahale.metrics.MetricRegistry.name; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class GraphiteUDPTransportTest { | ||
|
||
@Test | ||
public void testSendFailure() throws IOException { | ||
MetricRegistry metricRegistry = new MetricRegistry(); | ||
GraphiteUDPTransport transport = new GraphiteUDPTransport("xyz.salesforce.com", 8080, 1, metricRegistry); | ||
transport.open(); | ||
transport.send("key", "1", System.currentTimeMillis()); | ||
transport.close(); | ||
assertEquals(1L, metricRegistry.meter(name("graphite", "transport", "error-counts")).getCount()); | ||
} | ||
|
||
@Test | ||
public void testSendSuccess() throws IOException { | ||
MetricRegistry metricRegistry = new MetricRegistry(); | ||
GraphiteUDPTransport transport = new GraphiteUDPTransport("salesforce.com", 80, 1, metricRegistry); | ||
transport.open(); | ||
transport.send("key", "1", System.currentTimeMillis()); | ||
transport.close(); | ||
assertEquals(0L, metricRegistry.meter(name("graphite", "transport", "error-counts")).getCount()); | ||
assertEquals(1L, metricRegistry.meter(name("graphite", "transport", "metric-counts")).getCount()); | ||
} | ||
} |