Fix test case error
This commit is contained in:
parent
cc0a4915c7
commit
025b1b4980
@ -394,6 +394,14 @@ public class ServerListService implements ApplicationListener<WebServerInitializ
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(WebServerInitializedEvent event) {
|
||||
if (port == 0) {
|
||||
port = event.getWebServer().getPort();
|
||||
List<String> newList = new ArrayList<String>();
|
||||
for (String serverAddrTmp : serverList) {
|
||||
newList.add(getFormatServerAddr(serverAddrTmp));
|
||||
}
|
||||
setServerList(new ArrayList<String>(newList));
|
||||
}
|
||||
httpclient.start();
|
||||
CheckServerHealthTask checkServerHealthTask = new CheckServerHealthTask();
|
||||
TimerTaskService.scheduleWithFixedDelay(checkServerHealthTask, 0L, 5L, TimeUnit.SECONDS);
|
||||
|
@ -199,4 +199,4 @@ CREATE TABLE permissions (
|
||||
|
||||
INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE);
|
||||
|
||||
INSERT INTO roles (username, role) VALUES ('nacos', 'GLOBAL_ADMIN');
|
||||
INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN');
|
||||
|
@ -194,4 +194,4 @@ CREATE TABLE permissions (
|
||||
|
||||
INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE);
|
||||
|
||||
INSERT INTO roles (username, role) VALUES ('nacos', 'GLOBAL_ADMIN');
|
||||
INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN');
|
||||
|
@ -193,4 +193,4 @@ CREATE TABLE permissions (
|
||||
|
||||
INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE);
|
||||
|
||||
INSERT INTO roles (username, role) VALUES ('nacos', 'GLOBAL_ADMIN');
|
||||
INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN');
|
||||
|
@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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 com.alibaba.nacos.test.base;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -104,6 +104,7 @@ public class ConfigAuth_ITCase extends AuthBase {
|
||||
iconfig = NacosFactory.createConfigService(properties);
|
||||
|
||||
final String content = "test" + System.currentTimeMillis();
|
||||
System.out.println(content);
|
||||
|
||||
iconfig.addListener(dataId, group, new AbstractConfigChangeListener() {
|
||||
@Override
|
||||
@ -130,7 +131,8 @@ public class ConfigAuth_ITCase extends AuthBase {
|
||||
String res = iconfig.getConfig(dataId, group, TIME_OUT);
|
||||
Assert.assertEquals(content, res);
|
||||
|
||||
latch.await();
|
||||
latch.await(5L, TimeUnit.SECONDS);
|
||||
Assert.assertEquals( 0, latch.getCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -224,7 +226,9 @@ public class ConfigAuth_ITCase extends AuthBase {
|
||||
String res = iconfig.getConfig(dataId, group, TIME_OUT);
|
||||
Assert.assertEquals(content, res);
|
||||
|
||||
latch.await();
|
||||
latch.await(5L, TimeUnit.SECONDS);
|
||||
|
||||
Assert.assertEquals(0, latch.getCount());
|
||||
|
||||
result = iconfig.removeConfig(dataId, group);
|
||||
Assert.assertTrue(result);
|
||||
|
@ -119,7 +119,7 @@ public class CPInstancesAPI_ITCase {
|
||||
* @TestStep :
|
||||
* @ExpectResult :
|
||||
*/
|
||||
@Test(expected = AssertionError.class)
|
||||
@Test
|
||||
public void registerInstance_ephemeral_false() throws Exception {
|
||||
String serviceName = NamingBase.randomDomainName();
|
||||
namingServiceCreate(serviceName, TEST_NAMESPACE_1, TEST_GROUP_1);
|
||||
@ -174,7 +174,7 @@ public class CPInstancesAPI_ITCase {
|
||||
* @TestStep :
|
||||
* @ExpectResult :
|
||||
*/
|
||||
@Test(expected = AssertionError.class)
|
||||
@Test
|
||||
public void deleteService_hasInstace() throws Exception {
|
||||
String serviceName = NamingBase.randomDomainName();
|
||||
namingServiceCreate(serviceName, TEST_NAMESPACE_1);
|
||||
|
@ -193,4 +193,4 @@ CREATE TABLE permissions (
|
||||
|
||||
INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE);
|
||||
|
||||
INSERT INTO roles (username, role) VALUES ('nacos', 'GLOBAL_ADMIN');
|
||||
INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN');
|
||||
|
Loading…
Reference in New Issue
Block a user