Merge pull request #139 from bpgray/fix-config-tests

* fix-config-tests:
  add anonymous acl with kv store and discovery permissions
This commit is contained in:
Spencer Gibb
2016-02-10 14:15:48 -07:00
5 changed files with 26 additions and 35 deletions

View File

@@ -16,7 +16,7 @@ install:
script:
- ./src/test/bash/travis_run_consul.sh
- '[ "${TRAVIS_PULL_REQUEST}" != "false" ] || ./mvnw --settings .settings.xml deploy -nsu -Dmaven.test.redirectTestOutputToFile=true'
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] || ./mvnw --settings .settings.xml install -nsu -Dmaven.test.redirectTestOutputToFile=true'
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] || ./mvnw --settings .settings.xml install -nsu -Dmaven.test.redirectTestOutputToFile=true'
env:
global:
- GIT_NAME="Spencer Gibb"

30
pom.xml
View File

@@ -121,36 +121,6 @@
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/ConsulDiscoveryClientAclTests.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>ci</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/ConsulPropertySourceLocatorTests.java</exclude>
<exclude>**/ConsulDiscoveryClientAclTests.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@@ -1,6 +1,7 @@
#!/bin/bash
BASEDIR=`dirname $0`/../../..
${BASEDIR}/consul agent -server -bootstrap-expect 1 -advertise 127.0.0.1 -data-dir /tmp/consul -ui-dir ${BASEDIR}/src/test/resources/consul_ui & #-config-dir ${BASEDIR}/src/test/resources/consul_config &
${BASEDIR}/consul agent -server -bootstrap-expect 1 -advertise 127.0.0.1 -data-dir /tmp/consul -ui-dir ${BASEDIR}/src/test/resources/consul_ui -config-dir ${BASEDIR}/src/test/resources/consul_config &
# wait for consul to elect a leader before sending acl
#sleep 5
#curl -X PUT -d @`dirname $0`/../../test/resources/consul_acl/consul_discovery_client_acl.json http://localhost:8500/v1/acl/create?token=2ee647bd-bd69-4118-9f34-b9a6e9e60746
sleep 5
curl -X PUT -d @`dirname $0`/../../test/resources/consul_acl/consul_anonymous_acl.json http://localhost:8500/v1/acl/create?token=2ee647bd-bd69-4118-9f34-b9a6e9e60746
curl -X PUT -d @`dirname $0`/../../test/resources/consul_acl/consul_discovery_client_acl.json http://localhost:8500/v1/acl/create?token=2ee647bd-bd69-4118-9f34-b9a6e9e60746

View File

@@ -0,0 +1,20 @@
{
"ID": "anonymous",
"Name": "anonymous",
"Type": "client",
"Rules": "{
\"key\": {
\"\": {
\"policy\": \"write\"
}
},
\"service\": {
\"\": {
\"policy\": \"write\"
},
\"testConsulDiscoveryAcl\": {
\"policy\": \"read\"
}
}
}"
}

View File

@@ -2,5 +2,5 @@
"datacenter": "local",
"acl_datacenter": "local",
"acl_master_token": "2ee647bd-bd69-4118-9f34-b9a6e9e60746",
"acl_default_policy": "write"
"acl_default_policy": "deny"
}