Как увеличить тайм-аут в ожидании появления сервиса Couchbase Query - PullRequest
1 голос
/ 23 января 2020

Я запускаю couchbase в тест-контейнере (используя docker), и время ожидания ожидания запуска службы Query истекло. Как увеличить время ожидания со 120 секунд?

2020-01-23 19:19:43,026  INFO chbase.CouchbaseQueryServiceWaitStrategy:  33 - Waiting for 120 seconds for QUERY service
2020-01-23 19:21:43,041 ERROR           docker[couchbase/server:5.5.1]: 297 - Could not start container
org.testcontainers.containers.ContainerLaunchException: Timed out waiting for QUERY service
        at org.testcontainers.couchbase.CouchbaseQueryServiceWaitStrategy.waitUntilReady(CouchbaseQueryServiceWaitStrategy.java:52)
            at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:35)
            at org.testcontainers.couchbase.CouchbaseContainer.createBucket(CouchbaseContainer.java:277)
            at org.testcontainers.couchbase.CouchbaseContainer.containerIsStarted(CouchbaseContainer.java:332)
            at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:295)
            at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:237)
            at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:76)
            at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:235)
            at org.testcontainers.couchbase.CouchbaseContainer.doStart(CouchbaseContainer.java:140)
            at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:220)
            at org.testcontainers.containers.GenericContainer.starting(GenericContainer.java:738)
            at org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(FailureDetectingExternalResource.java:29)
            at org.junit.rules.RunRules.evaluate(RunRules.java:20)
            at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
            at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
            at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272)
            at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:236)
            at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
            at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:386)
            at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:323)
            at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:143)

1 Ответ

1 голос
/ 28 января 2020

Использование N1qlParams in N1qlQuery

        String query = "your query";
        N1qlParams n1qlParams = N1qlParams.build();
        n1qlParams.serverSideTimeout(120, TimeUnit.SECONDS);
        final N1qlQuery n1qlQuery = N1qlQuery.simple(query.toString(),n1qlParams);
        YourCouchbaseRepositoryObject.getCouchbaseOperations().findByN1QL(n1qlQuery, YourEntity.class);
...