Propagte mysql test datasource failure to UI. (#2001)
1. Propagte mysql test datasource failure exception message to UI. 2. Change build TC to reflect the same.
This commit is contained in:
parent
a900b48712
commit
d347448b24
|
|
@ -356,7 +356,7 @@ public class MySqlPlugin extends BasePlugin {
|
||||||
.then(Mono.just(new DatasourceTestResult()))
|
.then(Mono.just(new DatasourceTestResult()))
|
||||||
.onErrorResume(error -> {
|
.onErrorResume(error -> {
|
||||||
log.error("Error when testing MySQL datasource.", error);
|
log.error("Error when testing MySQL datasource.", error);
|
||||||
return Mono.error(Exceptions.propagate(error));
|
return Mono.just(new DatasourceTestResult(error.getMessage()));
|
||||||
})
|
})
|
||||||
.subscribeOn(scheduler);
|
.subscribeOn(scheduler);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,11 @@ import reactor.test.StepVerifier;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import static org.junit.Assert.assertNotEquals;
|
||||||
|
|
||||||
import static org.junit.Assert.assertArrayEquals;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.junit.Assert.assertArrayEquals;
|
||||||
|
|
||||||
@Log4j
|
@Log4j
|
||||||
public class MySqlPluginTest {
|
public class MySqlPluginTest {
|
||||||
|
|
@ -174,14 +173,18 @@ public class MySqlPluginTest {
|
||||||
public void testTestDatasource() {
|
public void testTestDatasource() {
|
||||||
/* Expect no error */
|
/* Expect no error */
|
||||||
StepVerifier.create(pluginExecutor.testDatasource(dsConfig))
|
StepVerifier.create(pluginExecutor.testDatasource(dsConfig))
|
||||||
.expectNextCount(1)
|
.assertNext(datasourceTestResult -> {
|
||||||
|
assertEquals(0, datasourceTestResult.getInvalids().size());
|
||||||
|
})
|
||||||
.verifyComplete();
|
.verifyComplete();
|
||||||
|
|
||||||
/* Create bad datasource configuration and expect error */
|
/* Create bad datasource configuration and expect error */
|
||||||
dsConfig.getEndpoints().get(0).setHost("badHost");
|
dsConfig.getEndpoints().get(0).setHost("badHost");
|
||||||
StepVerifier.create(pluginExecutor.testDatasource(dsConfig))
|
StepVerifier.create(pluginExecutor.testDatasource(dsConfig))
|
||||||
.expectError()
|
.assertNext(datasourceTestResult -> {
|
||||||
.verify();
|
assertNotEquals(0, datasourceTestResult.getInvalids().size());
|
||||||
|
})
|
||||||
|
.verifyComplete();
|
||||||
|
|
||||||
/* Reset dsConfig */
|
/* Reset dsConfig */
|
||||||
createDatasourceConfiguration();
|
createDatasourceConfiguration();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user