diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 54923f33..78e437f9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,6 +11,17 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: '1.22' + check-latest: true + + - name: Run control-plane-api tests + run: | + cd $GITHUB_WORKSPACE/provisioning/resources/control-plane + go test *.go + - name: Provision a local Mini instance run: ansible-playbook -i $GITHUB_WORKSPACE/provisioning/inventory $GITHUB_WORKSPACE/provisioning/local_setup.yml --connection=local --become diff --git a/CHANGELOG b/CHANGELOG index 1a915fae..730ea4c1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +Version 0.20.1 (2024-07-16) +--------------------------- +Add CacheTtl to DataConf struct in iglu_resolver_model (#403) +Bump Go to 1.22 (#403) +Run control-plane-api unit tests in Github Actions (#403) +Increase Iglu resolver's cacheTtl to 600 seconds (#403) + Version 0.20.0 (2024-03-04) --------------------------- Bump enrich to 4.1.0 diff --git a/VERSION b/VERSION index 5a03fb73..847e9aef 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.20.0 +0.20.1 diff --git a/provisioning/resources/configs/iglu-resolver.json b/provisioning/resources/configs/iglu-resolver.json index f96520a5..9dfaa386 100644 --- a/provisioning/resources/configs/iglu-resolver.json +++ b/provisioning/resources/configs/iglu-resolver.json @@ -2,7 +2,7 @@ "schema": "iglu:com.snowplowanalytics.iglu/resolver-config/jsonschema/1-0-2", "data": { "cacheSize": 500, - "cacheTtl": 1, + "cacheTtl": 600, "repositories": [ { "name": "Iglu Central", diff --git a/provisioning/resources/configs/openapi.yaml b/provisioning/resources/configs/openapi.yaml index 6f0e69be..559b0aa4 100644 --- a/provisioning/resources/configs/openapi.yaml +++ b/provisioning/resources/configs/openapi.yaml @@ -3,7 +3,7 @@ info: title: "Snowplow Mini" description: | Snowplow Mini is a small, single instance version of Snowplow that primarily serves as a development sandbox which gives you a quick way to debug tracker updates and changes to your schema and pipeline configuration. - version: "0.20.0" + version: "0.20.1" license: name: "Snowplow Limited Use License" url: "https://docs.snowplow.io/limited-use-license-1.0/" diff --git a/provisioning/resources/control-plane/change_credentials_test.go b/provisioning/resources/control-plane/change_credentials_test.go index 89880e6e..e0cec20f 100644 --- a/provisioning/resources/control-plane/change_credentials_test.go +++ b/provisioning/resources/control-plane/change_credentials_test.go @@ -11,36 +11,26 @@ package main import ( - "github.com/stretchr/testify/assert" + "encoding/base64" "io/ioutil" "os" "path/filepath" + "strings" "testing" + + "github.com/stretchr/testify/assert" + "golang.org/x/crypto/bcrypt" ) func TestChangeCredentials(t *testing.T) { assert := assert.New(t) caddyConfigHeadBefore := - `*:80 { - tls off - basicauth "USERNAME_PLACEHOLDER" PASSWORD_PLACEHOLDER { - /home - /kibana - /elasticsearch - /control-plane - } -` - expectedCaddyConfigHeadAfter := - `*:80 { - tls off - basicauth username_test password_test { - /home - /kibana - /elasticsearch - /control-plane - } + `basicauth @protectedPaths { + USERNAME_PLACEHOLDER JDJhJDA0JFRYSENkLi4vamh0cm1UcHhKWTZEaGVEWm1OMzk4SVZ0ZTVONVVLUzQ5Q3MvYjE0eUF4bEJL + } ` + dir, err := ioutil.TempDir("", "testDir") assert.Nil(err) @@ -51,15 +41,26 @@ func TestChangeCredentials(t *testing.T) { err = ioutil.WriteFile(tmpfn, []byte(caddyConfigHeadBefore), 0666) assert.Nil(err) - err = changeCredentials( + testPassword := "5uwk1A,9kdj1!kdkA." + + err, _ = changeCredentials( tmpfn, "username_test", - "password_test", + testPassword, ) assert.Nil(err) - caddyConfigAfter, err := ioutil.ReadFile(tmpfn) + caddyConfigLines, err := fileToLines(tmpfn) assert.Nil(err) - assert.True(expectedCaddyConfigHeadAfter == string(caddyConfigAfter)) + testUsernameExist := false + for _, line := range caddyConfigLines { + if strings.Contains(line, "username_test") { + testUsernameExist = true + base64EncodedHashedPassword := strings.Fields(line)[1] + hashedPassword, _ := base64.StdEncoding.DecodeString(base64EncodedHashedPassword) + assert.Nil(bcrypt.CompareHashAndPassword(hashedPassword, []byte(testPassword))) + } + } + assert.True(testUsernameExist) } diff --git a/provisioning/resources/control-plane/external_iglu_test.go b/provisioning/resources/control-plane/external_iglu_test.go index e91528e2..2fa1f2ec 100644 --- a/provisioning/resources/control-plane/external_iglu_test.go +++ b/provisioning/resources/control-plane/external_iglu_test.go @@ -27,6 +27,7 @@ func TestAddExternalIgluServer(t *testing.T) { "schema": "iglu:com.snowplowanalytics.iglu/resolver-config/jsonschema/1-0-1", "data": { "cacheSize": 500, + "cacheTtl": 1, "repositories": [ { "name": "Iglu Server", @@ -51,6 +52,7 @@ func TestAddExternalIgluServer(t *testing.T) { "schema": "iglu:com.snowplowanalytics.iglu/resolver-config/jsonschema/1-0-1", "data": { "cacheSize": 500, + "cacheTtl": 1, "repositories": [ { "name": "Iglu Server", @@ -108,7 +110,7 @@ func TestAddExternalIgluServer(t *testing.T) { afterInsert, err := ioutil.ReadFile(tmpfn) assert.Nil(err) - assert.True(string(afterInsert) == expectedIgluConfigAfter) + assert.JSONEq(string(afterInsert), expectedIgluConfigAfter) } func TestAddExternalIgluServerWithoutApiKey(t *testing.T) { @@ -119,6 +121,7 @@ func TestAddExternalIgluServerWithoutApiKey(t *testing.T) { "schema": "iglu:com.snowplowanalytics.iglu/resolver-config/jsonschema/1-0-1", "data": { "cacheSize": 500, + "cacheTtl": 1, "repositories": [ { "name": "Iglu Server", @@ -143,6 +146,7 @@ func TestAddExternalIgluServerWithoutApiKey(t *testing.T) { "schema": "iglu:com.snowplowanalytics.iglu/resolver-config/jsonschema/1-0-1", "data": { "cacheSize": 500, + "cacheTtl": 1, "repositories": [ { "name": "Iglu Server", @@ -199,5 +203,5 @@ func TestAddExternalIgluServerWithoutApiKey(t *testing.T) { afterInsert, err := ioutil.ReadFile(tmpfn) assert.Nil(err) - assert.True(string(afterInsert) == expectedIgluConfigAfter) + assert.JSONEq(string(afterInsert), expectedIgluConfigAfter) } diff --git a/provisioning/resources/control-plane/go.mod b/provisioning/resources/control-plane/go.mod new file mode 100644 index 00000000..f540f458 --- /dev/null +++ b/provisioning/resources/control-plane/go.mod @@ -0,0 +1,23 @@ +module control-plane + +go 1.22.5 + +require ( + github.com/BurntSushi/toml v1.4.0 + github.com/stretchr/testify v1.9.0 + github.com/trustelem/zxcvbn v1.0.1 + golang.org/x/crypto v0.24.0 + gopkg.in/pg.v5 v5.3.3 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/dlclark/regexp2 v1.11.0 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/onsi/ginkgo v1.16.5 // indirect + github.com/onsi/gomega v1.33.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/test-go/testify v1.1.4 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/provisioning/resources/control-plane/go.sum b/provisioning/resources/control-plane/go.sum new file mode 100644 index 00000000..e3f26608 --- /dev/null +++ b/provisioning/resources/control-plane/go.sum @@ -0,0 +1,104 @@ +github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= +github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= +github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= +github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE= +github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU= +github.com/trustelem/zxcvbn v1.0.1 h1:mp4JFtzdDYGj9WYSD3KQSkwwUumWNFzXaAjckaTYpsc= +github.com/trustelem/zxcvbn v1.0.1/go.mod h1:zonUyKeh7sw6psPf/e3DtRqkRyZvAbOfjNz/aO7YQ5s= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= +golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/pg.v5 v5.3.3 h1:WGfb/lVyakKS3dFgAu5KOab/vHrNZYHPbLYkjKQuVJo= +gopkg.in/pg.v5 v5.3.3/go.mod h1:A7QNerFceY0s3tPuavny+PCy6m9RQ9LrsF3onyQVvNc= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/provisioning/resources/control-plane/iglu_resolver_model.go b/provisioning/resources/control-plane/iglu_resolver_model.go index 77bf5ba3..2b4f63e0 100644 --- a/provisioning/resources/control-plane/iglu_resolver_model.go +++ b/provisioning/resources/control-plane/iglu_resolver_model.go @@ -23,6 +23,7 @@ type RepoConf struct { type DataConf struct { CacheSize int `json:"cacheSize"` + CacheTtl int `json:"cacheTtl"` Repos []RepoConf `json:"repositories"` } diff --git a/provisioning/resources/control-plane/local_iglu_test.go b/provisioning/resources/control-plane/local_iglu_test.go index b6289047..5e13db9a 100644 --- a/provisioning/resources/control-plane/local_iglu_test.go +++ b/provisioning/resources/control-plane/local_iglu_test.go @@ -11,11 +11,12 @@ package main import ( - "github.com/stretchr/testify/assert" "io/ioutil" "os" "path/filepath" "testing" + + "github.com/stretchr/testify/assert" ) func TestAddApiKeyToConfig(t *testing.T) { @@ -26,6 +27,7 @@ func TestAddApiKeyToConfig(t *testing.T) { "schema": "iglu:com.snowplowanalytics.iglu/resolver-config/jsonschema/1-0-1", "data": { "cacheSize": 500, + "cacheTtl": 1, "repositories": [ { "name": "Iglu Server", @@ -35,7 +37,7 @@ func TestAddApiKeyToConfig(t *testing.T) { ], "connection": { "http": { - "uri": "http://localhost:8081/api", + "uri": "http://iglu-server:8081/api", "apikey": "PLACEHOLDER" } } @@ -48,6 +50,7 @@ func TestAddApiKeyToConfig(t *testing.T) { "schema": "iglu:com.snowplowanalytics.iglu/resolver-config/jsonschema/1-0-1", "data": { "cacheSize": 500, + "cacheTtl": 1, "repositories": [ { "name": "Iglu Server", @@ -57,7 +60,7 @@ func TestAddApiKeyToConfig(t *testing.T) { ], "connection": { "http": { - "uri": "http://localhost:8081/api", + "uri": "http://iglu-server:8081/api", "apikey": "iglu_apikey" } } @@ -71,6 +74,7 @@ func TestAddApiKeyToConfig(t *testing.T) { "schema": "iglu:com.snowplowanalytics.iglu/resolver-config/jsonschema/1-0-1", "data": { "cacheSize": 500, + "cacheTtl": 1, "repositories": [ { "name": "Iglu Server", @@ -80,7 +84,7 @@ func TestAddApiKeyToConfig(t *testing.T) { ], "connection": { "http": { - "uri": "http://localhost:8081/api" + "uri": "http://iglu-server:8081/api" } } } @@ -93,6 +97,7 @@ func TestAddApiKeyToConfig(t *testing.T) { "schema": "iglu:com.snowplowanalytics.iglu/resolver-config/jsonschema/1-0-1", "data": { "cacheSize": 500, + "cacheTtl": 1, "repositories": [ { "name": "Iglu Server", @@ -102,7 +107,7 @@ func TestAddApiKeyToConfig(t *testing.T) { ], "connection": { "http": { - "uri": "http://localhost:8081/api", + "uri": "http://iglu-server:8081/api", "apikey": "iglu_apikey" } } @@ -132,8 +137,7 @@ func TestAddApiKeyToConfig(t *testing.T) { afterInsert, err := ioutil.ReadFile(tmpfn) assert.Nil(err) - - assert.True(string(afterInsert) == expectedIgluConfigOne) + assert.JSONEq(string(afterInsert), expectedIgluConfigOne) err = ioutil.WriteFile(tmpfn, []byte(igluConfigTwo), 0666) assert.Nil(err) @@ -144,5 +148,5 @@ func TestAddApiKeyToConfig(t *testing.T) { afterInsert, err = ioutil.ReadFile(tmpfn) assert.Nil(err) - assert.True(string(afterInsert) == expectedIgluConfigTwo) + assert.JSONEq(string(afterInsert), expectedIgluConfigTwo) } diff --git a/provisioning/resources/ui/js/components/Overview.tsx b/provisioning/resources/ui/js/components/Overview.tsx index 3c688cc8..6eca6108 100644 --- a/provisioning/resources/ui/js/components/Overview.tsx +++ b/provisioning/resources/ui/js/components/Overview.tsx @@ -49,7 +49,7 @@ export class Overview extends React.Component<{}, {}> {

The software stack installed: