Add Zookeeper discovery client smoke test
See gh-104
This commit is contained in:
committed by
Andy Wilkinson
parent
044009ab5f
commit
4cb693e38c
@@ -12,6 +12,7 @@ smoke_tests:
|
||||
- cache-redis
|
||||
- cache-simple
|
||||
- cache-simple-jdk-proxy
|
||||
- cloud-discovery-zookeeper
|
||||
- cloud-function-web
|
||||
- cloud-function-webflux
|
||||
- cloud-stream-kafka
|
||||
|
||||
30
cloud-discovery-zookeeper/build.gradle
Normal file
30
cloud-discovery-zookeeper/build.gradle
Normal file
@@ -0,0 +1,30 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot'
|
||||
id 'org.springframework.aot.smoke-test'
|
||||
id 'org.graalvm.buildtools.native'
|
||||
}
|
||||
|
||||
ext {
|
||||
set('springCloudVersion', "2022.0.0-SNAPSHOT")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(platform(
|
||||
org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
|
||||
implementation(
|
||||
platform("org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"))
|
||||
implementation("org.springframework.boot:spring-boot-starter")
|
||||
implementation("org.springframework.boot:spring-boot-starter-webflux")
|
||||
implementation("org.springframework.cloud:spring-cloud-starter-zookeeper-discovery")
|
||||
implementation(project(":aot-smoke-test-third-party-hints"))
|
||||
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
||||
|
||||
aotSmokeTestImplementation(project(":aot-smoke-test-support"))
|
||||
aotSmokeTestImplementation("org.awaitility:awaitility:4.2.0")
|
||||
}
|
||||
|
||||
aotSmokeTest {
|
||||
webApplication = true
|
||||
}
|
||||
6
cloud-discovery-zookeeper/docker-compose.yml
Normal file
6
cloud-discovery-zookeeper/docker-compose.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
version: '3'
|
||||
services:
|
||||
zookeeper:
|
||||
image: zookeeper:latest
|
||||
ports:
|
||||
- "2181:2181"
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.example.cloud.discovery.zookeeper;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.aot.smoketest.support.assertj.AssertableOutput;
|
||||
import org.springframework.aot.smoketest.support.junit.AotSmokeTest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@AotSmokeTest
|
||||
class ZookeeperDiscoveryClientApplicationAotTests {
|
||||
|
||||
@Test
|
||||
void shouldRegisterWithZookeeper(AssertableOutput output) {
|
||||
Awaitility.await().atMost(Duration.ofSeconds(30))
|
||||
.untilAsserted(() -> assertThat(output).hasLineContaining("Session establishment complete on server"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.example.cloud.discovery.zookeeper;
|
||||
|
||||
import org.springframework.aot.smoketest.thirdpartyhints.NettyRuntimeHints;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ImportRuntimeHints;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@ImportRuntimeHints(NettyRuntimeHints.class)
|
||||
@SpringBootApplication
|
||||
public class ZookeeperDiscoveryClientApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ZookeeperDiscoveryClientApplication.class, args);
|
||||
}
|
||||
|
||||
@RestController
|
||||
static class TestController {
|
||||
|
||||
@GetMapping("/")
|
||||
public String test() {
|
||||
return "test";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
spring:
|
||||
application:
|
||||
name: zookeeper-discovery-client
|
||||
@@ -40,6 +40,7 @@ include "cache-hazelcast"
|
||||
include "cache-redis"
|
||||
include "cache-simple"
|
||||
include "cache-simple-jdk-proxy"
|
||||
include "cloud-discovery-zookeeper"
|
||||
include "cloud-function-web"
|
||||
include "cloud-function-webflux"
|
||||
include "cloud-stream-kafka"
|
||||
|
||||
Reference in New Issue
Block a user