You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ch...@apache.org on 2021/06/16 10:56:00 UTC
[iotdb] branch rel/0.12 updated: [To rel/0.12]try to fix the
AsyncMetaClientTest (#3411)
This is an automated email from the ASF dual-hosted git repository.
chaow pushed a commit to branch rel/0.12
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/0.12 by this push:
new 8ad6e9a [To rel/0.12]try to fix the AsyncMetaClientTest (#3411)
8ad6e9a is described below
commit 8ad6e9a669347885a66099d5d52759e7678dc0e8
Author: Houliang Qi <ne...@163.com>
AuthorDate: Wed Jun 16 18:55:36 2021 +0800
[To rel/0.12]try to fix the AsyncMetaClientTest (#3411)
---
.../cluster/client/async/AsyncMetaClientTest.java | 28 ++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/cluster/src/test/java/org/apache/iotdb/cluster/client/async/AsyncMetaClientTest.java b/cluster/src/test/java/org/apache/iotdb/cluster/client/async/AsyncMetaClientTest.java
index 15d53de..5c1cf7b 100644
--- a/cluster/src/test/java/org/apache/iotdb/cluster/client/async/AsyncMetaClientTest.java
+++ b/cluster/src/test/java/org/apache/iotdb/cluster/client/async/AsyncMetaClientTest.java
@@ -1,5 +1,20 @@
/*
- * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless [...]
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.iotdb.cluster.client.async;
@@ -17,6 +32,7 @@ import org.apache.thrift.async.TAsyncClientManager;
import org.apache.thrift.protocol.TBinaryProtocol.Factory;
import org.apache.thrift.transport.TNonblockingSocket;
import org.junit.After;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -72,9 +88,17 @@ public class AsyncMetaClientTest {
@Override
public void onError(Exception e) {
- // do nothing
+ try {
+ // Simulate the time to do the task when an exception occurs
+ Thread.sleep(Long.MAX_VALUE / 2);
+ } catch (InterruptedException ie) {
+ Assert.fail(ie.getMessage());
+ }
}
});
+ // When the above code calls client.matchTerm(), the previous task has not been completed
+ // because the time of doing the task is simulated in onError(Exception e), so
+ // client.isReady()=false
assertFalse(client.isReady());
client.onError(new Exception());