Fix mongodb datasource test. (#1783)
1. Fix mongodb datasource cypress test failure. 2. Against certain mongodb instances, we expect to receive an exception of type "unauthorized" when testing datasource. Earlier, this case was caught and whitelisted until the recent change to replace mongodb infra with reactive mongodb infra.
This commit is contained in:
parent
941be8c58d
commit
2c6d1bb361
|
|
@ -341,7 +341,19 @@ public class MongoPlugin extends BasePlugin {
|
|||
})
|
||||
.then(Mono.just(new DatasourceTestResult()))
|
||||
.onErrorResume(error -> {
|
||||
return Mono.just(new DatasourceTestResult(error.getMessage()));});
|
||||
/**
|
||||
* 1. Return OK response on "Unauthorized" exception.
|
||||
* 2. If we get an exception with error code "Unauthorized" then it means that the connection to
|
||||
* the MongoDB instance is valid. It also means we don't have access to the admin database,
|
||||
* but that's okay for our purposes here.
|
||||
*/
|
||||
if(error instanceof MongoCommandException &&
|
||||
((MongoCommandException) error).getErrorCodeName().equals("Unauthorized")) {
|
||||
return Mono.just(new DatasourceTestResult());
|
||||
}
|
||||
|
||||
return Mono.just(new DatasourceTestResult(error.getMessage()));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user