Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v7
- uses: actions/setup-go@v6
with:
go-version-file: src/github.com/cloudfoundry/config-server/go.mod
go-version-file: src/config-server/go.mod
- uses: golangci/golangci-lint-action@v9
with:
working-directory: src/github.com/cloudfoundry/config-server/
working-directory: src/config-server/
2 changes: 1 addition & 1 deletion ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ jobs:
- task: bump-deps
file: golang-release/ci/tasks/shared/bump-deps.yml
params:
SOURCE_PATH: src/github.com/cloudfoundry/config-server/
SOURCE_PATH: src/config-server/
input_mapping:
input_repo: config-server
output_mapping:
Expand Down
2 changes: 1 addition & 1 deletion ci/tasks/bosh-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cd -
cd config-server
git submodule update --init --recursive

cd src/github.com/cloudfoundry/config-server
cd src/config-server
git checkout "${config_server_sha}"
cd -

Expand Down
2 changes: 1 addition & 1 deletion ci/tasks/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export PATH=/usr/local/go/bin:${PATH}

binary_name="config-server-${GOOS}-${GOARCH}"

pushd config-server/src/github.com/cloudfoundry/config-server/
pushd config-server/src/config-server/
go build -o "${binary_name}" .

openssl sha256 "${binary_name}"
Expand Down
2 changes: 1 addition & 1 deletion ci/tasks/lint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -eu -o pipefail

cd config-server/src/github.com/cloudfoundry/config-server/
cd config-server/src/config-server/

bin/lint
4 changes: 2 additions & 2 deletions ci/tasks/test-integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ case "$DB" in
echo "Memory DB Noop"
;;
*)
echo "Usage: DB={mysql|postgresql|memory} $0 {commands}"
echo "Usage: DB={mysql|postgresql|memory} $0"
exit 1
esac

cd config-server/src/github.com/cloudfoundry/config-server/
cd config-server/src/config-server/

bin/test-integration "${DB}"
2 changes: 1 addition & 1 deletion ci/tasks/test-unit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ set -eu -o pipefail

export PATH=/usr/local/go/bin:${PATH}

cd config-server/src/github.com/cloudfoundry/config-server/
cd config-server/src/config-server/

SKIP_LINT=true bin/test-unit
2 changes: 1 addition & 1 deletion packages/config_server/packaging
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ source /var/vcap/packages/golang-1-linux/bosh/compile.env

mkdir -p $BOSH_INSTALL_TARGET/bin

pushd github.com/cloudfoundry/config-server
pushd config-server
go build -mod=vendor -o $BOSH_INSTALL_TARGET/bin/config-server .
popd
8 changes: 4 additions & 4 deletions packages/config_server/spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: config_server
dependencies:
- golang-1-linux
files:
- github.com/cloudfoundry/config-server/**/*.go
- github.com/cloudfoundry/config-server/go.mod
- github.com/cloudfoundry/config-server/go.sum
- github.com/cloudfoundry/config-server/vendor/**/*
- config-server/**/*.go
- config-server/go.mod
- config-server/go.sum
- config-server/vendor/**/*
23 changes: 23 additions & 0 deletions src/config-server/bin/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -eu -o pipefail

config_server_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"

(
cd "${config_server_dir}"
if ! command -v golangci-lint &> /dev/null; then
go install -v github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
fi
)

golangci-lint version

linted_os_list=(linux)

for os in "${linted_os_list[@]}"; do
echo -e "\n lint-ing with GOOS=${os}..."
(
cd "${config_server_dir}"
GOOS="${os}" golangci-lint run ./...
)
done
26 changes: 26 additions & 0 deletions src/config-server/bin/test-integration
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -eu -o pipefail

config_server_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"

run_tests (){
export DB=$1
echo -e "\n\nRunning Integration tests for $DB\n\n"

pushd "${config_server_dir}"
go run github.com/onsi/ginkgo/v2/ginkgo run -r --race integration
popd
}

case "${1:-}" in
memory )
run_tests memory ;;
mysql )
run_tests mysql ;;
postgresql )
run_tests postgresql ;;
* )
echo "Usage: ${0} {mysql|postgresql|memory}"
exit 1
;;
esac
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ var _ = Describe("Supported HTTP Methods", func() {
var session *gexec.Session

BeforeEach(func() {
SetupDB()
SetupDB(GinkgoWriter)

var err error
cmd := exec.Command(pathToConfigServer, pathToConfigFile)
cmd := exec.Command(pathToConfigServer, ConfigForDb())
session, err = gexec.Start(cmd, GinkgoWriter, GinkgoWriter)
Expect(err).NotTo(HaveOccurred())

Expand All @@ -35,7 +35,7 @@ var _ = Describe("Supported HTTP Methods", func() {
resultMap := UnmarshalJSONString(response.Body)

Expect(resultMap["id"]).ToNot(BeNil())
Expect(len((resultMap["id"].(string))) > 0).To(BeTrue())
Expect(len(resultMap["id"].(string)) > 0).To(BeTrue())
Expect(resultMap["name"]).To(Equal("Dale"))
Expect(resultMap["value"]).To(Equal("Wick"))
})
Expand All @@ -44,12 +44,12 @@ var _ = Describe("Supported HTTP Methods", func() {
response1, _ := SendPutRequest("Dale", "Wick") //nolint:errcheck
resultMap1 := UnmarshalJSONString(response1.Body)
Expect(resultMap1["id"]).ToNot(BeNil())
Expect(len((resultMap1["id"].(string))) > 0).To(BeTrue())
Expect(len(resultMap1["id"].(string)) > 0).To(BeTrue())

response2, _ := SendPutRequest("Alan", "Donovan") //nolint:errcheck
resultMap2 := UnmarshalJSONString(response2.Body)
Expect(resultMap2["id"]).ToNot(BeNil())
Expect(len((resultMap2["id"].(string))) > 0).To(BeTrue())
Expect(len(resultMap2["id"].(string)) > 0).To(BeTrue())

Expect(resultMap1["id"]).ToNot(Equal(resultMap2["id"]))
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package integration_test

import (
"os"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
Expand All @@ -12,7 +10,6 @@ import (

var (
pathToConfigServer string
pathToConfigFile string
)

func TestIntegrationTests(t *testing.T) {
Expand All @@ -26,5 +23,4 @@ var _ = SynchronizedBeforeSuite(func() []byte {
return []byte(configServerPath)
}, func(data []byte) {
pathToConfigServer = string(data)
pathToConfigFile = os.Getenv("CONFIG_FILE")
})
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ var _ = Describe("Supported HTTP Methods", func() {
var session *gexec.Session

BeforeEach(func() {
SetupDB()
SetupDB(GinkgoWriter)

var err error
cmd := exec.Command(pathToConfigServer, pathToConfigFile)
cmd := exec.Command(pathToConfigServer, ConfigForDb())
session, err = gexec.Start(cmd, GinkgoWriter, GinkgoWriter)
Expect(err).NotTo(HaveOccurred())

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"port": 9000,
"store": "memory",
"certificate_file_path": "support/assets/ssl.crt",
"private_key_file_path": "support/assets/ssl.key",
"jwt_verification_key_path": "support/assets/uaa.pub"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"max_idle_connections": 10
}
},
"certificate_file_path": "./assets/ssl.crt",
"private_key_file_path": "./assets/ssl.key",
"jwt_verification_key_path": "./assets/uaa.pub"
"certificate_file_path": "support/assets/ssl.crt",
"private_key_file_path": "support/assets/ssl.key",
"jwt_verification_key_path": "support/assets/uaa.pub"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"max_idle_connections": 10
}
},
"certificate_file_path": "./assets/ssl.crt",
"private_key_file_path": "./assets/ssl.key",
"jwt_verification_key_path": "./assets/uaa.pub"
"certificate_file_path": "support/assets/ssl.crt",
"private_key_file_path": "support/assets/ssl.key",
"jwt_verification_key_path": "support/assets/uaa.pub"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash

set -e

if which certstrap ; then
Expand All @@ -8,9 +7,10 @@ if which certstrap ; then
certstrap --depot-path "$folder" init --cn config-server --expires "5 years" --passphrase "" > /dev/null 2>&1
certstrap --depot-path "$folder" request-cert --cn integration --ip 127.0.0.1 --domain localhost --passphrase "" > /dev/null 2>&1
certstrap --depot-path "$folder" sign --expires "5 years" --CA config-server integration > /dev/null 2>&1
cp "$folder"/config-server.crt integration/assets/ssl_root_ca.crt
cp "$folder"/integration.crt integration/assets/ssl.crt
cp "$folder"/integration.key integration/assets/ssl.key

cp "$folder/config-server.crt" ssl_root_ca.crt
cp "$folder/integration.crt" ssl.crt
cp "$folder/integration.key" ssl.key
echo "Done! Your certs have been regenerated"
else
echo "This requires certstrap, install it from here: https://github.com/square/certstrap"
Expand Down
Loading
Loading