Added circle.ci integration

- also limited to 5 seconds awaits
This commit is contained in:
Marcin Grzejszczak
2016-07-11 15:14:21 +02:00
parent 81f70ff071
commit f199321878
13 changed files with 57 additions and 63 deletions

View File

@@ -1,38 +0,0 @@
language: java
jdk:
- oraclejdk8
sudo: required
dist: trusty
cache:
directories:
- $HOME/.m2
install:
- |
cat <<EOF
Running build with the following parameters
FEATURE_BRANCH=${FEATURE_BRANCH}
SPRING_CLOUD_BUILD=${SPRING_CLOUD_BUILD}
MVN_GOAL=${MVN_GOAL}
VERSION=${VERSION}
MILESTONE=${MILESTONE}
MVN_PROFILE=${MVN_PROFILE}
TRAVIS_BRANCH=${TRAVIS_BRANCH}
TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG}
TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST}
EOF
script:
#- ./mvnw -s .settings.xml $MVN_GOAL $MVN_PROFILE -nsu --batch-mode > log.log || echo "FAILED!" && grep -v '^.*Download.* http.*$' log.log && exit 1
- './mvnw -s .settings.xml $MVN_GOAL $MVN_PROFILE -nsu -U --batch-mode -Dmaven.test.redirectTestOutputToFile=true'
env:
global:
- FEATURE_BRANCH=$(echo ${TRAVIS_BRANCH} | grep -v "master" && echo true || echo false)
- SPRING_CLOUD_BUILD=$(echo ${TRAVIS_REPO_SLUG} | grep -q "^spring-cloud/.*$" && echo true || echo false)
- MVN_GOAL=install
- VERSION=$(mvn validate | grep Building | head -1 | sed -e 's/.* //')
- MILESTONE=$(echo ${VERSION} | egrep 'M|RC' && echo true || echo false)
- MVN_PROFILE=$([ "${MILESTONE}" == "true" ] && echo -P milestone)
- TERM=dumb

View File

@@ -2,7 +2,7 @@
:jdkversion: 1.8
image::https://api.travis-ci.org/spring-cloud/spring-cloud-sleuth.svg?branch=master[Build Status, link=https://travis-ci.org/spring-cloud/spring-cloud-sleuth]
image:https://circleci.com/gh/spring-cloud/spring-cloud-sleuth.svg?style=svg["CircleCI", link="https://circleci.com/gh/spring-cloud/spring-cloud-sleuth"]
image::https://badges.gitter.im/spring-cloud/spring-cloud-sleuth.svg[Gitter, link="https://gitter.im/spring-cloud/spring-cloud-sleuth?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"]
== Spring Cloud Sleuth
@@ -666,7 +666,7 @@ follow the guidelines below.
=== Sign the Contributor License Agreement
Before we accept a non-trivial patch or pull request we will need you to sign the
https://support.springsource.com/spring_committer_signup[contributor's agreement].
https://cla.pivotal.io/sign/spring[Contributor License Agreement].
Signing the contributor's agreement does not grant anyone commit rights to the main
repository, but it does mean that we can accept your contributions, and you will get an
author credit if we do. Active contributors might be asked to join the core team, and

19
circle.yml Normal file
View File

@@ -0,0 +1,19 @@
machine:
java:
version: oraclejdk8
environment:
_JAVA_OPTIONS: "-Xms1024m -Xmx2048m"
dependencies:
override:
- ./mvnw -s .settings.xml --fail-never dependency:go-offline || true
test:
override:
- ./mvnw -s .settings.xml clean install -nsu --batch-mode -Dmaven.test.redirectTestOutputToFile=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
post:
- mkdir -p $CIRCLE_TEST_REPORTS/junit/
- find . -type f -regex ".*/target/.*-reports/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \
notify:
webhooks:
# A list of hook hashes, containing the url field
# gitter hook
- url: https://webhooks.gitter.im/e/fac69f6fc000ef14f7ec

View File

@@ -1,6 +1,6 @@
:jdkversion: 1.8
image::https://api.travis-ci.org/spring-cloud/spring-cloud-sleuth.svg?branch=master[Build Status, link=https://travis-ci.org/spring-cloud/spring-cloud-sleuth]
image:https://circleci.com/gh/spring-cloud/spring-cloud-sleuth.svg?style=svg["CircleCI", link="https://circleci.com/gh/spring-cloud/spring-cloud-sleuth"]
image::https://badges.gitter.im/spring-cloud/spring-cloud-sleuth.svg[Gitter, link="https://gitter.im/spring-cloud/spring-cloud-sleuth?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"]
== Spring Cloud Sleuth

View File

@@ -16,9 +16,12 @@
package org.springframework.cloud.sleuth.instrument.hystrix;
import java.util.concurrent.atomic.AtomicReference;
import com.jayway.awaitility.Awaitility;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.strategy.HystrixPlugins;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -38,8 +41,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.concurrent.atomic.AtomicReference;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.assertj.core.api.BDDAssertions.then;
import static org.springframework.cloud.sleuth.assertions.SleuthAssertions.then;
@@ -89,7 +91,7 @@ public class HystrixAnnotationsIntegrationTests {
private void thenSpanInHystrixThreadIsContinued(final Span span) {
then(span).isNotNull();
Awaitility.await().until(new Runnable() {
Awaitility.await().atMost(5, SECONDS).until(new Runnable() {
@Override
public void run() {
then(HystrixAnnotationsIntegrationTests.this.catcher).isNotNull();
@@ -103,7 +105,7 @@ public class HystrixAnnotationsIntegrationTests {
}
private void thenSpanInHystrixThreadIsCreated() {
Awaitility.await().until(new Runnable() {
Awaitility.await().atMost(5, SECONDS).until(new Runnable() {
@Override
public void run() {
then(HystrixAnnotationsIntegrationTests.this.catcher.getSpan())

View File

@@ -29,6 +29,7 @@ import rx.plugins.RxJavaPlugins;
import rx.schedulers.Schedulers;
import static com.jayway.awaitility.Awaitility.await;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.springframework.cloud.sleuth.assertions.SleuthAssertions.then;
@RunWith(SpringJUnit4ClassRunner.class)
@@ -65,7 +66,7 @@ public class SleuthRxJavaTests {
then(this.caller.toString()).isEqualTo("actual_action");
then(this.tracer.getCurrentSpan()).isNull();
await().until(() -> then(this.listener.getEvents()).hasSize(1));
await().atMost(5, SECONDS).until(() -> then(this.listener.getEvents()).hasSize(1));
then(this.listener.getEvents().get(0)).hasNameEqualTo("rxjava");
then(this.listener.getEvents().get(0)).isExportable();
then(this.listener.getEvents().get(0)).hasATag(Span.SPAN_LOCAL_COMPONENT_TAG_NAME, "rxjava");

View File

@@ -33,6 +33,7 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static com.jayway.awaitility.Awaitility.await;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.springframework.cloud.sleuth.assertions.SleuthAssertions.then;
@RunWith(SpringJUnit4ClassRunner.class)
@@ -44,18 +45,18 @@ public class TracingOnScheduledTests {
@Test
public void should_have_span_set_after_scheduled_method_has_been_executed() {
await().until(spanIsSetOnAScheduledMethod());
await().atMost(5, SECONDS).until(spanIsSetOnAScheduledMethod());
}
@Test
public void should_have_a_new_span_set_each_time_a_scheduled_method_has_been_executed() {
Span firstSpan = this.beanWithScheduledMethod.getSpan();
await().until(differentSpanHasBeenSetThan(firstSpan));
await().atMost(5, SECONDS).until(differentSpanHasBeenSetThan(firstSpan));
}
@Test
public void should_not_span_in_the_scheduled_class_that_matches_skip_pattern() throws Exception {
await().untilAtomic(this.beanWithScheduledMethodToBeIgnored.isExecuted(), Matchers.is(true));
await().atMost(5, SECONDS).untilAtomic(this.beanWithScheduledMethodToBeIgnored.isExecuted(), Matchers.is(true));
then(this.beanWithScheduledMethodToBeIgnored.getSpan()).isNull();
}

View File

@@ -21,6 +21,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.springframework.cloud.sleuth.assertions.SleuthAssertions.then;
@RunWith(SpringJUnit4ClassRunner.class)
@@ -49,7 +50,7 @@ public class TraceAsyncIntegrationTests {
}
private void thenTraceIdIsPassedFromTheCurrentThreadToTheAsyncOne(final Span span) {
Awaitility.await().until(new Runnable() {
Awaitility.await().atMost(5, SECONDS).until(new Runnable() {
@Override
public void run() {
then(TraceAsyncIntegrationTests.this.classPerformingAsyncLogic.getSpan())

View File

@@ -53,6 +53,7 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import static com.jayway.awaitility.Awaitility.await;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.assertj.core.api.BDDAssertions.then;
import static org.springframework.cloud.sleuth.assertions.SleuthAssertions.then;
@@ -86,7 +87,7 @@ public class TraceFilterCustomExtractorTests {
ResponseEntity<Map> responseHeaders = this.restTemplate.exchange(requestEntity,
Map.class);
await().until(() -> then(this.accumulator.getSpans().stream().filter(
await().atMost(5, SECONDS).until(() -> then(this.accumulator.getSpans().stream().filter(
span -> span.getSpanId() == spanId).findFirst().get())
.hasTraceIdEqualTo(traceId));
then(responseHeaders.getBody())

View File

@@ -22,6 +22,7 @@ import org.springframework.test.web.servlet.setup.DefaultMockMvcBuilder;
import static com.jayway.awaitility.Awaitility.await;
import static java.util.Arrays.asList;
import static java.util.concurrent.TimeUnit.SECONDS;
import static java.util.stream.Collectors.toList;
import static org.assertj.core.api.BDDAssertions.then;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
@@ -46,7 +47,7 @@ public class MultipleHopsIntegrationTests extends AbstractMvcIntegrationTest {
this.mockMvc.perform(get("/greeting")).andExpect(
MockMvcResultMatchers.status().isOk());
await().until(() -> {
await().atMost(5, SECONDS).until(() -> {
then(this.arrayListSpanAccumulator.getSpans().stream().map(Span::getName)
.collect(
toList())).containsAll(asList("http:/greeting", "message:greetings",

View File

@@ -41,6 +41,7 @@ import tools.AbstractIntegrationTest;
import zipkin.Constants;
import zipkin.Span;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.assertj.core.api.BDDAssertions.then;
@RunWith(SpringJUnit4ClassRunner.class)
@@ -63,9 +64,9 @@ public class MessagingApplicationTests extends AbstractIntegrationTest {
public void should_have_passed_trace_id_when_message_is_about_to_be_sent() {
long traceId = new Random().nextLong();
await().until(httpMessageWithTraceIdInHeadersIsSuccessfullySent(sampleAppUrl + "/", traceId));
await().atMost(5, SECONDS).until(httpMessageWithTraceIdInHeadersIsSuccessfullySent(sampleAppUrl + "/", traceId));
await().until(() -> {
await().atMost(5, SECONDS).until(() -> {
thenAllSpansHaveTraceIdEqualTo(traceId);
});
}
@@ -75,9 +76,9 @@ public class MessagingApplicationTests extends AbstractIntegrationTest {
long traceId = new Random().nextLong();
long spanId = new Random().nextLong();
await().until(httpMessageWithTraceIdInHeadersIsSuccessfullySent(sampleAppUrl + "/", traceId, spanId));
await().atMost(5, SECONDS).until(httpMessageWithTraceIdInHeadersIsSuccessfullySent(sampleAppUrl + "/", traceId, spanId));
await().until(() -> {
await().atMost(5, SECONDS).until(() -> {
thenAllSpansHaveTraceIdEqualTo(traceId);
thenTheSpansHaveProperParentStructure();
});
@@ -87,9 +88,9 @@ public class MessagingApplicationTests extends AbstractIntegrationTest {
public void should_have_passed_trace_id_with_annotations_in_async_thread_when_message_is_about_to_be_sent() {
long traceId = new Random().nextLong();
await().until(httpMessageWithTraceIdInHeadersIsSuccessfullySent(sampleAppUrl + "/xform", traceId));
await().atMost(5, SECONDS).until(httpMessageWithTraceIdInHeadersIsSuccessfullySent(sampleAppUrl + "/xform", traceId));
await().until(() -> {
await().atMost(5, SECONDS).until(() -> {
thenAllSpansHaveTraceIdEqualTo(traceId);
thenThereIsAtLeastOneBinaryAnnotationWithKey("background-sleep-millis");
});

View File

@@ -18,7 +18,6 @@ package integration;
import java.util.Collections;
import java.util.Random;
import example.ZipkinStreamServerApplication;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -37,8 +36,12 @@ import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import example.ZipkinStreamServerApplication;
import tools.AbstractIntegrationTest;
import static java.util.concurrent.TimeUnit.SECONDS;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = { TestSupportBinderAutoConfiguration.class,
ZipkinStreamServerApplication.class })
@@ -57,7 +60,7 @@ public class ZipkinStreamTests extends AbstractIntegrationTest {
@Before
public void setup() {
await().until(zipkinServerIsUp());
await().atMost(5, SECONDS).until(zipkinServerIsUp());
}
@Test
@@ -67,7 +70,7 @@ public class ZipkinStreamTests extends AbstractIntegrationTest {
this.input.send(messageWithSpan(span));
await().until(allSpansWereRegisteredInZipkinWithTraceIdEqualTo(this.traceId));
await().atMost(5, SECONDS).until(allSpansWereRegisteredInZipkinWithTraceIdEqualTo(this.traceId));
}
private Message<Spans> messageWithSpan(Span span) {

View File

@@ -40,6 +40,8 @@ import tools.AbstractIntegrationTest;
import zipkin.junit.ZipkinRule;
import zipkin.server.EnableZipkinServer;
import static java.util.concurrent.TimeUnit.SECONDS;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = { WaitUntilZipkinIsUpConfig.class,
SampleZipkinApplication.class })
@@ -67,10 +69,10 @@ public class ZipkinTests extends AbstractIntegrationTest {
public void should_propagate_spans_to_zipkin() {
long traceId = new Random().nextLong();
await().until(httpMessageWithTraceIdInHeadersIsSuccessfullySent(
await().atMost(5, SECONDS).until(httpMessageWithTraceIdInHeadersIsSuccessfullySent(
this.sampleAppUrl + "/hi2", traceId));
await().until(allSpansWereRegisteredInZipkinWithTraceIdEqualTo(traceId));
await().atMost(5, SECONDS).until(allSpansWereRegisteredInZipkinWithTraceIdEqualTo(traceId));
}
@Override