Skip to content

Commit c99a7ac

Browse files
committed
fix
1 parent 4ba4292 commit c99a7ac

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/test/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistryDigestTestCase.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package org.apache.dolphinscheduler.plugin.registry.zookeeper;
1919

20+
import static org.apache.zookeeper.ZooDefs.Ids.OPEN_ACL_UNSAFE;
21+
2022
import org.apache.dolphinscheduler.plugin.registry.RegistryTestCase;
2123

2224
import org.apache.zookeeper.ZooDefs;
@@ -27,6 +29,7 @@
2729
import org.apache.zookeeper.server.DumbWatcher;
2830
import org.apache.zookeeper.server.auth.DigestAuthenticationProvider;
2931

32+
import java.nio.charset.StandardCharsets;
3033
import java.util.Collections;
3134
import java.util.stream.Stream;
3235

@@ -37,11 +40,13 @@
3740
import org.springframework.beans.factory.annotation.Autowired;
3841
import org.springframework.boot.autoconfigure.SpringBootApplication;
3942
import org.springframework.boot.test.context.SpringBootTest;
43+
import org.springframework.test.context.ActiveProfiles;
4044
import org.testcontainers.containers.GenericContainer;
4145
import org.testcontainers.containers.Network;
4246
import org.testcontainers.lifecycle.Startables;
4347
import org.testcontainers.utility.DockerImageName;
4448

49+
@ActiveProfiles("digest")
4550
@SpringBootTest(classes = ZookeeperRegistryProperties.class)
4651
@SpringBootApplication(scanBasePackageClasses = ZookeeperRegistryProperties.class)
4752
public class ZookeeperRegistryDigestTestCase extends RegistryTestCase<ZookeeperRegistry> {
@@ -67,6 +72,10 @@ public static void setupRootACLForDigest(final ZooKeeper zk) throws Exception {
6772
zk.setACL("/", Collections.singletonList(acl), -1);
6873
}
6974

75+
public static void resetRootACL(final ZooKeeper zk) throws Exception {
76+
zk.setACL("/", OPEN_ACL_UNSAFE, -1);
77+
}
78+
7079
@SneakyThrows
7180
@BeforeAll
7281
public static void setUpTestingServer() {
@@ -78,7 +87,6 @@ public static void setUpTestingServer() {
7887
System.setProperty("registry.zookeeper.connect-string", "localhost:" + zookeeperContainer.getMappedPort(2181));
7988
zk = new ZooKeeper("localhost:" + zookeeperContainer.getMappedPort(2181),
8089
30000, new DumbWatcher(), new ZKClientConfig());
81-
System.setProperty("registry.zookeeper.authorization.digest", ID_PASSWORD);
8290
setupRootACLForDigest(zk);
8391
}
8492

@@ -91,6 +99,8 @@ public ZookeeperRegistry createRegistry() {
9199
@SneakyThrows
92100
@AfterAll
93101
public static void tearDownTestingServer() {
102+
zk.addAuthInfo("digest", ID_PASSWORD.getBytes(StandardCharsets.UTF_8));
103+
resetRootACL(zk);
94104
zk.close();
95105
zookeeperContainer.close();
96106
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
registry:
19+
type: zookeeper
20+
zookeeper:
21+
namespace: dolphinscheduler
22+
connect-string: 127.0.0.1:2181
23+
retry-policy:
24+
base-sleep-time: 60ms
25+
max-sleep: 300ms
26+
max-retries: 5
27+
session-timeout: 30s
28+
connection-timeout: 9s
29+
block-until-connected: 3s
30+
authorization:
31+
digest: root:root_passwd

0 commit comments

Comments
 (0)