Skip to content

Commit

Permalink
Add integration test
Browse files Browse the repository at this point in the history
Run an artifactory server in CI and configure a vault dev server to use
the plugin.

Create some basic roles and ensure they receive the expected permissions
based on group membership by deploying some files to a local repo.
  • Loading branch information
jsok committed Aug 10, 2019
1 parent 80595fc commit 4d58825
Show file tree
Hide file tree
Showing 4 changed files with 558 additions and 7 deletions.
52 changes: 45 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,56 @@ jobs:
- image: circleci/golang:1.12
steps:
- checkout
- run: mkdir -p workspace/plugins workspace/coverage
- run:
name: Build
command: |
go build -o bin/vault-plugin-secrets-artifactory .
- run:
name: Create directory for artifacts
command: |
mkdir -p /tmp/artifacts
mkdir -p workspace/plugins
go build -a -ldflags '-linkmode external -extldflags "-static"' -o workspace/plugins/artifactory ./cmd/vault-plugin-secrets-artifactory
- persist_to_workspace:
root: workspace
paths:
- plugins
- run:
name: Unit tests
command: |
go test -cover -coverprofile=coverage.out -v ./...
go tool cover -html=coverage.out -o /tmp/artifacts/coverage.html
go tool cover -html=coverage.out -o workspace/coverage/coverage.html
- store_artifacts:
path: workspace

integration:
docker:
- image: vault:1.2.1
environment:
ARTIFACTORY_URL: http://localhost:8081/artifactory
VAULT_ADDR: http://127.0.0.1:8200
VAULT_TOKEN: root-token
VAULT_PLUGIN_DIR: workspace/plugins
VAULT_LOG_DIR: workspace/integration
- image: docker.bintray.io/jfrog/artifactory-oss:latest
environment:
ARTIFACTORY_MASTER_KEY: "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
steps:
- checkout
- attach_workspace:
at: workspace
- run:
name: Install dependencies
command: |
apk add --update --no-cache bash curl
- run:
name: Integration tests
command: |
./integration/test.sh
- store_artifacts:
path: /tmp/artifacts
path: workspace

workflows:
version: 2
build-and-test:
jobs:
- build
- integration:
requires:
- build
269 changes: 269 additions & 0 deletions integration/artifactory.config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<config xmlns="http://artifactory.jfrog.org/xsd/2.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jfrog.org/xsd/artifactory-v2_2_0.xsd">
<offlineMode>false</offlineMode>
<helpLinksEnabled>true</helpLinksEnabled>
<fileUploadMaxSizeMb>100</fileUploadMaxSizeMb>
<revision>11</revision>
<dateFormat>dd-MM-yy HH:mm:ss z</dateFormat>
<addons>
<showAddonsInfo>true</showAddonsInfo>
<showAddonsInfoCookie>1565407695531</showAddonsInfoCookie>
</addons>
<security>
<anonAccessEnabled>true</anonAccessEnabled>
<hideUnauthorizedResources>false</hideUnauthorizedResources>
<passwordSettings>
<encryptionPolicy>supported</encryptionPolicy>
<expirationPolicy>
<enabled>false</enabled>
<passwordMaxAge>60</passwordMaxAge>
<notifyByEmail>true</notifyByEmail>
</expirationPolicy>
<resetPolicy>
<enabled>true</enabled>
<maxAttemptsPerAddress>3</maxAttemptsPerAddress>
<timeToBlockInMinutes>60</timeToBlockInMinutes>
</resetPolicy>
</passwordSettings>
<ldapSettings/>
<ldapGroupSettings/>
<userLockPolicy>
<enabled>false</enabled>
<loginAttempts>5</loginAttempts>
</userLockPolicy>
<accessClientSettings/>
<buildGlobalBasicReadAllowed>false</buildGlobalBasicReadAllowed>
<buildGlobalBasicReadForAnonymous>false</buildGlobalBasicReadForAnonymous>
</security>
<backups>
<backup>
<key>backup-daily</key>
<enabled>true</enabled>
<cronExp>0 0 2 ? * MON-FRI</cronExp>
<retentionPeriodHours>0</retentionPeriodHours>
<createArchive>false</createArchive>
<excludedRepositories/>
<sendMailOnError>true</sendMailOnError>
<excludeNewRepositories>false</excludeNewRepositories>
<precalculate>false</precalculate>
</backup>
<backup>
<key>backup-weekly</key>
<enabled>false</enabled>
<cronExp>0 0 2 ? * SAT</cronExp>
<retentionPeriodHours>336</retentionPeriodHours>
<createArchive>false</createArchive>
<excludedRepositories/>
<sendMailOnError>true</sendMailOnError>
<excludeNewRepositories>false</excludeNewRepositories>
<precalculate>false</precalculate>
</backup>
</backups>
<indexer>
<enabled>false</enabled>
<cronExp>0 23 5 * * ?</cronExp>
</indexer>
<localRepositories>
<localRepository>
<key>artifactory-build-info</key>
<type>buildinfo</type>
<description>Build Info repository</description>
<includesPattern>**/*</includesPattern>
<repoLayoutRef>simple-default</repoLayoutRef>
<dockerApiVersion>V2</dockerApiVersion>
<forceNugetAuthentication>false</forceNugetAuthentication>
<blackedOut>false</blackedOut>
<handleReleases>true</handleReleases>
<handleSnapshots>true</handleSnapshots>
<maxUniqueSnapshots>0</maxUniqueSnapshots>
<maxUniqueTags>0</maxUniqueTags>
<suppressPomConsistencyChecks>true</suppressPomConsistencyChecks>
<propertySets/>
<archiveBrowsingEnabled>false</archiveBrowsingEnabled>
<snapshotVersionBehavior>unique</snapshotVersionBehavior>
<localRepoChecksumPolicyType>client-checksums</localRepoChecksumPolicyType>
<calculateYumMetadata>false</calculateYumMetadata>
<yumRootDepth>0</yumRootDepth>
<debianTrivialLayout>false</debianTrivialLayout>
<enableFileListsIndexing>false</enableFileListsIndexing>
</localRepository>
<localRepository>
<key>local</key>
<type>generic</type>
<includesPattern>**/*</includesPattern>
<repoLayoutRef>simple-default</repoLayoutRef>
<dockerApiVersion>V2</dockerApiVersion>
<forceNugetAuthentication>false</forceNugetAuthentication>
<blackedOut>false</blackedOut>
<handleReleases>true</handleReleases>
<handleSnapshots>true</handleSnapshots>
<maxUniqueSnapshots>0</maxUniqueSnapshots>
<maxUniqueTags>0</maxUniqueTags>
<suppressPomConsistencyChecks>true</suppressPomConsistencyChecks>
<propertySets/>
<archiveBrowsingEnabled>false</archiveBrowsingEnabled>
<snapshotVersionBehavior>unique</snapshotVersionBehavior>
<localRepoChecksumPolicyType>client-checksums</localRepoChecksumPolicyType>
<calculateYumMetadata>false</calculateYumMetadata>
<yumRootDepth>0</yumRootDepth>
<debianTrivialLayout>false</debianTrivialLayout>
<enableFileListsIndexing>false</enableFileListsIndexing>
</localRepository>
</localRepositories>
<remoteRepositories/>
<virtualRepositories/>
<distributionRepositories/>
<releaseBundlesRepositories/>
<proxies/>
<reverseProxies/>
<propertySets/>
<repoLayouts>
<repoLayout>
<name>maven-2-default</name>
<artifactPathPattern>[orgPath]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]</artifactPathPattern>
<distinctiveDescriptorPathPattern>true</distinctiveDescriptorPathPattern>
<descriptorPathPattern>[orgPath]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).pom</descriptorPathPattern>
<folderIntegrationRevisionRegExp>SNAPSHOT</folderIntegrationRevisionRegExp>
<fileIntegrationRevisionRegExp>SNAPSHOT|(?:(?:[0-9]{8}.[0-9]{6})-(?:[0-9]+))</fileIntegrationRevisionRegExp>
</repoLayout>
<repoLayout>
<name>ivy-default</name>
<artifactPathPattern>[org]/[module]/[baseRev](-[folderItegRev])/[type]s/[module](-[classifier])-[baseRev](-[fileItegRev]).[ext]</artifactPathPattern>
<distinctiveDescriptorPathPattern>true</distinctiveDescriptorPathPattern>
<descriptorPathPattern>[org]/[module]/[baseRev](-[folderItegRev])/[type]s/ivy-[baseRev](-[fileItegRev]).xml</descriptorPathPattern>
<folderIntegrationRevisionRegExp>\d{14}</folderIntegrationRevisionRegExp>
<fileIntegrationRevisionRegExp>\d{14}</fileIntegrationRevisionRegExp>
</repoLayout>
<repoLayout>
<name>gradle-default</name>
<artifactPathPattern>[org]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]</artifactPathPattern>
<distinctiveDescriptorPathPattern>true</distinctiveDescriptorPathPattern>
<descriptorPathPattern>[org]/[module]/ivy-[baseRev](-[fileItegRev]).xml</descriptorPathPattern>
<folderIntegrationRevisionRegExp>\d{14}</folderIntegrationRevisionRegExp>
<fileIntegrationRevisionRegExp>\d{14}</fileIntegrationRevisionRegExp>
</repoLayout>
<repoLayout>
<name>maven-1-default</name>
<artifactPathPattern>[org]/[type]s/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]</artifactPathPattern>
<distinctiveDescriptorPathPattern>true</distinctiveDescriptorPathPattern>
<descriptorPathPattern>[org]/[type]s/[module]-[baseRev](-[fileItegRev]).pom</descriptorPathPattern>
<folderIntegrationRevisionRegExp>.+</folderIntegrationRevisionRegExp>
<fileIntegrationRevisionRegExp>.+</fileIntegrationRevisionRegExp>
</repoLayout>
<repoLayout>
<name>nuget-default</name>
<artifactPathPattern>[orgPath]/[module]/[module].[baseRev](-[fileItegRev]).nupkg</artifactPathPattern>
<distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern>
<folderIntegrationRevisionRegExp>.*</folderIntegrationRevisionRegExp>
<fileIntegrationRevisionRegExp>.*</fileIntegrationRevisionRegExp>
</repoLayout>
<repoLayout>
<name>npm-default</name>
<artifactPathPattern>[orgPath]/[module]/[module]-[baseRev](-[fileItegRev]).tgz</artifactPathPattern>
<distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern>
<folderIntegrationRevisionRegExp>.*</folderIntegrationRevisionRegExp>
<fileIntegrationRevisionRegExp>.*</fileIntegrationRevisionRegExp>
</repoLayout>
<repoLayout>
<name>bower-default</name>
<artifactPathPattern>[orgPath]/[module]/[module]-[baseRev](-[fileItegRev]).[ext]</artifactPathPattern>
<distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern>
<folderIntegrationRevisionRegExp>.*</folderIntegrationRevisionRegExp>
<fileIntegrationRevisionRegExp>.*</fileIntegrationRevisionRegExp>
</repoLayout>
<repoLayout>
<name>vcs-default</name>
<artifactPathPattern>[orgPath]/[module]/[refs&lt;tags|branches&gt;]/[baseRev]/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]</artifactPathPattern>
<distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern>
<folderIntegrationRevisionRegExp>.*</folderIntegrationRevisionRegExp>
<fileIntegrationRevisionRegExp>[a-zA-Z0-9]{40}</fileIntegrationRevisionRegExp>
</repoLayout>
<repoLayout>
<name>sbt-default</name>
<artifactPathPattern>[org]/[module]/(scala_[scalaVersion&lt;.+&gt;])/(sbt_[sbtVersion&lt;.+&gt;])/[baseRev]/[type]s/[module](-[classifier]).[ext]</artifactPathPattern>
<distinctiveDescriptorPathPattern>true</distinctiveDescriptorPathPattern>
<descriptorPathPattern>[org]/[module]/(scala_[scalaVersion&lt;.+&gt;])/(sbt_[sbtVersion&lt;.+&gt;])/[baseRev]/[type]s/ivy.xml</descriptorPathPattern>
<folderIntegrationRevisionRegExp>\d{14}</folderIntegrationRevisionRegExp>
<fileIntegrationRevisionRegExp>\d{14}</fileIntegrationRevisionRegExp>
</repoLayout>
<repoLayout>
<name>simple-default</name>
<artifactPathPattern>[orgPath]/[module]/[module]-[baseRev].[ext]</artifactPathPattern>
<distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern>
<folderIntegrationRevisionRegExp>.*</folderIntegrationRevisionRegExp>
<fileIntegrationRevisionRegExp>.*</fileIntegrationRevisionRegExp>
</repoLayout>
<repoLayout>
<name>composer-default</name>
<artifactPathPattern>[orgPath]/[module]/[module]-[baseRev](-[fileItegRev]).[ext]</artifactPathPattern>
<distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern>
<folderIntegrationRevisionRegExp>.*</folderIntegrationRevisionRegExp>
<fileIntegrationRevisionRegExp>.*</fileIntegrationRevisionRegExp>
</repoLayout>
<repoLayout>
<name>conan-default</name>
<artifactPathPattern>[org]/[module]/[baseRev]/[channel&lt;[^/]+&gt;]/[folderItegRev]/(package/[package_id&lt;[^/]+&gt;]/[fileItegRev]/)?[remainder&lt;(?:.+)&gt;]</artifactPathPattern>
<distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern>
<folderIntegrationRevisionRegExp>[^/]+</folderIntegrationRevisionRegExp>
<fileIntegrationRevisionRegExp>[^/]+</fileIntegrationRevisionRegExp>
</repoLayout>
<repoLayout>
<name>puppet-default</name>
<artifactPathPattern>[orgPath]/[module]/[orgPath]-[module]-[baseRev].tar.gz</artifactPathPattern>
<distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern>
<folderIntegrationRevisionRegExp>.*</folderIntegrationRevisionRegExp>
<fileIntegrationRevisionRegExp>.*</fileIntegrationRevisionRegExp>
</repoLayout>
<repoLayout>
<name>go-default</name>
<artifactPathPattern>[orgPath]/[module]/@v/v[refs].zip</artifactPathPattern>
<distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern>
<folderIntegrationRevisionRegExp>.*</folderIntegrationRevisionRegExp>
<fileIntegrationRevisionRegExp>.*</fileIntegrationRevisionRegExp>
</repoLayout>
<repoLayout>
<name>build-default</name>
<artifactPathPattern>[orgPath]/[module](-[fileItegRev]).[ext]</artifactPathPattern>
<distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern>
<folderIntegrationRevisionRegExp>.*</folderIntegrationRevisionRegExp>
<fileIntegrationRevisionRegExp>.*</fileIntegrationRevisionRegExp>
</repoLayout>
</repoLayouts>
<remoteReplications/>
<localReplications/>
<gcConfig>
<cronExp>0 0 /4 * * ?</cronExp>
</gcConfig>
<cleanupConfig>
<cronExp>0 12 5 * * ?</cronExp>
</cleanupConfig>
<virtualCacheCleanupConfig>
<cronExp>0 12 0 * * ?</cronExp>
</virtualCacheCleanupConfig>
<folderDownloadConfig>
<enabled>false</enabled>
<enabledForAnonymous>false</enabledForAnonymous>
<maxDownloadSizeMb>1024</maxDownloadSizeMb>
<maxFiles>5000</maxFiles>
<maxConcurrentRequests>10</maxConcurrentRequests>
</folderDownloadConfig>
<trashcanConfig>
<enabled>true</enabled>
<allowPermDeletes>false</allowPermDeletes>
<retentionPeriodDays>14</retentionPeriodDays>
</trashcanConfig>
<replicationsConfig>
<blockPushReplications>false</blockPushReplications>
<blockPullReplications>false</blockPullReplications>
</replicationsConfig>
<bintrayApplications/>
<sumoLogicConfig>
<enabled>false</enabled>
</sumoLogicConfig>
<releaseBundlesConfig>
<incompleteCleanupPeriodHours>720</incompleteCleanupPeriodHours>
</releaseBundlesConfig>
<signedUrlConfig>
<maxValidForSeconds>31536000</maxValidForSeconds>
</signedUrlConfig>
</config>
Loading

0 comments on commit 4d58825

Please sign in to comment.