Skip to content

Commit

Permalink
feat: tools-2616 tools-2648 support server 6.4 configs (#15)
Browse files Browse the repository at this point in the history
* feat: tools-2616 support server 6.4 configs

* ci: add allowed error to server64 test

* ci: use docker CLI to get logs

* ci: don't hide feature key version errors

* fix: tools-2648 parse sindex-type from asconf

* ci: test colon delimited secrets-address-port
  • Loading branch information
dwelch-spike authored Aug 22, 2023
1 parent 8f006d2 commit d1690a8
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 16 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module aerospike/asconfig
go 1.19

require (
github.com/aerospike/aerospike-management-lib v0.0.0-20230721181710-e0ad7587b911
github.com/aerospike/aerospike-management-lib v0.0.0-20230822200615-d2c51f8be9c7
github.com/bombsimon/logrusr/v4 v4.0.0
github.com/docker/docker v23.0.3+incompatible
github.com/go-logr/logr v1.2.3
Expand Down
20 changes: 20 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@ github.com/aerospike/aerospike-management-lib v0.0.0-20230721173757-ee3d780a0142
github.com/aerospike/aerospike-management-lib v0.0.0-20230721173757-ee3d780a0142/go.mod h1:sTlH+QtluBfc1ZkUaB3sfpZxd4aIux13ENkztyh0lsY=
github.com/aerospike/aerospike-management-lib v0.0.0-20230721181710-e0ad7587b911 h1:pZ7Z38Qvy8am2xNrerESD+RDUjR0t4uja5bc1bZGCpc=
github.com/aerospike/aerospike-management-lib v0.0.0-20230721181710-e0ad7587b911/go.mod h1:sTlH+QtluBfc1ZkUaB3sfpZxd4aIux13ENkztyh0lsY=
github.com/aerospike/aerospike-management-lib v0.0.0-20230815231638-e2fe5d024ff8 h1:thYiVEQIry5x5SCr586iaKbMQD/vtd3yvdQI/0RsxCc=
github.com/aerospike/aerospike-management-lib v0.0.0-20230815231638-e2fe5d024ff8/go.mod h1:sTlH+QtluBfc1ZkUaB3sfpZxd4aIux13ENkztyh0lsY=
github.com/aerospike/aerospike-management-lib v0.0.0-20230816200813-3190ce0edae0 h1:q2WyhmaFUA8wXTNSDD1/LYw5T0kr4KXTetMo0SAyCok=
github.com/aerospike/aerospike-management-lib v0.0.0-20230816200813-3190ce0edae0/go.mod h1:sTlH+QtluBfc1ZkUaB3sfpZxd4aIux13ENkztyh0lsY=
github.com/aerospike/aerospike-management-lib v0.0.0-20230816202429-d065cc95654a h1:Xf9ohUc2W/Xv7pbc5KJDvSZTXj6R00Jacnpl6fQKaMc=
github.com/aerospike/aerospike-management-lib v0.0.0-20230816202429-d065cc95654a/go.mod h1:sTlH+QtluBfc1ZkUaB3sfpZxd4aIux13ENkztyh0lsY=
github.com/aerospike/aerospike-management-lib v0.0.0-20230816205303-06c8e66a7feb h1:iu0Alq5OA6HEgWqY88Cao7VJ/oLcIZ1dXd2ZLPoXzfI=
github.com/aerospike/aerospike-management-lib v0.0.0-20230816205303-06c8e66a7feb/go.mod h1:sTlH+QtluBfc1ZkUaB3sfpZxd4aIux13ENkztyh0lsY=
github.com/aerospike/aerospike-management-lib v0.0.0-20230822172728-20e37b8709f3 h1:8h+Mjh52GsicN64g9orkHko3j4cGUJtrMe3hpTdy0po=
github.com/aerospike/aerospike-management-lib v0.0.0-20230822172728-20e37b8709f3/go.mod h1:sTlH+QtluBfc1ZkUaB3sfpZxd4aIux13ENkztyh0lsY=
github.com/aerospike/aerospike-management-lib v0.0.0-20230822173759-ad428008d0ba h1:REidvX6m57gfvvfjDwwfPEUyRhugmsTEC7JXHUwZOvA=
github.com/aerospike/aerospike-management-lib v0.0.0-20230822173759-ad428008d0ba/go.mod h1:sTlH+QtluBfc1ZkUaB3sfpZxd4aIux13ENkztyh0lsY=
github.com/aerospike/aerospike-management-lib v0.0.0-20230822184602-2c376f926901 h1:53/1ZRPs4mdIeKip+L+tm33lSWHz7XNAwGdpJWFIWnY=
github.com/aerospike/aerospike-management-lib v0.0.0-20230822184602-2c376f926901/go.mod h1:sTlH+QtluBfc1ZkUaB3sfpZxd4aIux13ENkztyh0lsY=
github.com/aerospike/aerospike-management-lib v0.0.0-20230822185320-14b3ae8f64af h1:wmBKU4Vxb5OIrQWFOJXS/vEKRG2W4k936Lc/zOfNwiA=
github.com/aerospike/aerospike-management-lib v0.0.0-20230822185320-14b3ae8f64af/go.mod h1:sTlH+QtluBfc1ZkUaB3sfpZxd4aIux13ENkztyh0lsY=
github.com/aerospike/aerospike-management-lib v0.0.0-20230822190551-58b773166475 h1:tmsTO9UnWDGDCcDXMiyumIozufGvGYQs2qMV/HPc4z8=
github.com/aerospike/aerospike-management-lib v0.0.0-20230822190551-58b773166475/go.mod h1:sTlH+QtluBfc1ZkUaB3sfpZxd4aIux13ENkztyh0lsY=
github.com/aerospike/aerospike-management-lib v0.0.0-20230822200615-d2c51f8be9c7 h1:MWJbQO+FRcw6wuAxD3MsjZkouyO5UPSWEzLcoeobrYc=
github.com/aerospike/aerospike-management-lib v0.0.0-20230822200615-d2c51f8be9c7/go.mod h1:sTlH+QtluBfc1ZkUaB3sfpZxd4aIux13ENkztyh0lsY=
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/bombsimon/logrusr/v4 v4.0.0 h1:Pm0InGphX0wMhPqC02t31onlq9OVyJ98eP/Vh63t1Oo=
github.com/bombsimon/logrusr/v4 v4.0.0/go.mod h1:pjfHC5e59CvjTBIU3V3sGhFWFAnsnhOR03TRc6im0l8=
Expand Down
24 changes: 10 additions & 14 deletions integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"encoding/json"
"errors"
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
Expand All @@ -21,7 +20,6 @@ import (

"aerospike/asconfig/testutils"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/mount"
"github.com/docker/docker/client"
Expand Down Expand Up @@ -465,13 +463,6 @@ func runServer(version string, confPath string, dockerClient *client.Client, t *
t.Error(err)
}

logReader, err := dockerClient.ContainerLogs(context.Background(), id, types.ContainerLogsOptions{ShowStdout: true, ShowStderr: true, Follow: true})
if err != nil {
t.Error(err)
}

defer logReader.Close()

// need this to allow logs to accumulate
time.Sleep(time.Second * 3)

Expand All @@ -494,7 +485,7 @@ func runServer(version string, confPath string, dockerClient *client.Client, t *
case <-statusCh:
}

data, err := io.ReadAll(logReader)
data, err := docker("logs", id)
if err != nil {
t.Error(err)
}
Expand Down Expand Up @@ -526,10 +517,6 @@ func runServer(version string, confPath string, dockerClient *client.Client, t *
// always ignore this failure
td.ServerErrorAllowList = append(td.ServerErrorAllowList, "' is enterprise-only")

// TODO support both feature key versions for testing
// servers older than 5.4 won't accept version 2 feature key files. Suppress this for now
td.ServerErrorAllowList = append(td.ServerErrorAllowList, " invalid value 2 for feature feature-key-version")

reg := regexp.MustCompile(`CRITICAL \(config\):.*`)
configErrors := reg.FindAllString(containerOut, -1)
for _, cfgErr := range configErrors {
Expand Down Expand Up @@ -762,6 +749,15 @@ func TestConfToYaml(t *testing.T) {
}
}

func docker(args ...string) ([]byte, error) {
com := exec.Command("docker", args...)
out, err := com.Output()
if err != nil {
err = fmt.Errorf("docker failed err: %s, out: %s", err, string(out))
}
return out, err
}

func diff(args ...string) ([]byte, error) {
args = append([]string{"diff"}, args...)
com := exec.Command(binPath+"/asconfig.test", args...)
Expand Down
2 changes: 1 addition & 1 deletion schema/schemas
Submodule schemas updated 1 files
+2,881 −0 json/aerospike/6.4.0.json
1 change: 1 addition & 0 deletions testdata/cases/server64/conf-tests.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"Source":"testdata/cases/server64/server64.conf","Destination":"testdata/cases/server64/server64-res-.yaml","Expected":"testdata/cases/server64/server64.yaml","Arguments":["convert","--aerospike-version","6.4.0.1","--format","asconfig","--output","testdata/cases/server64/server64-res-.yaml"],"SkipServerTest":false,"ServerErrorAllowList":["each of: /proc/sys/vm/dirty_bytes"]}]
65 changes: 65 additions & 0 deletions testdata/cases/server64/server64.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

service {
user root
group root
pidfile /dummy/file/path1
proto-fd-max 15000

secrets-address-port test_dns_name 4000 127.0.0.1
secrets-tls-context tlscontext
secrets-uds-path /test/path/socket
}

logging {

file /dummy/file/path2 {
context any info
}
}

network {
service {
address any
port 3000
}

heartbeat {
mode multicast
multicast-group 127.0.0.1
port 9918




interval 150
timeout 10
}

fabric {
port 3001
}

info {
port 3003
}
}

namespace ns1 {
replication-factor 2
memory-size 4G

index-type flash {
mount /dummy/mount/point1 /test/mount2
mounts-high-water-pct 30
mounts-size-limit 10G
}

sindex-type flash {
mount /dummy/mount/point3
mounts-high-water-pct 60
mounts-size-limit 20000M
}

storage-engine memory
}

45 changes: 45 additions & 0 deletions testdata/cases/server64/server64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
logging:
- any: info
name: /dummy/file/path2
namespaces:
- index-type:
mounts:
- /dummy/mount/point1 /test/mount2
mounts-high-water-pct: 30
mounts-size-limit: 10737418240
type: flash
memory-size: 4294967296
name: ns1
replication-factor: 2
sindex-type:
mounts:
- /dummy/mount/point3
mounts-high-water-pct: 60
mounts-size-limit: 20971520000
type: flash
storage-engine:
type: memory
network:
fabric:
port: 3001
heartbeat:
interval: 150
mode: multicast
multicast-groups:
- 127.0.0.1
port: 9918
timeout: 10
info:
port: 3003
service:
addresses:
- any
port: 3000
service:
group: root
pidfile: /dummy/file/path1
proto-fd-max: 15000
secrets-address-port: test_dns_name:4000:127.0.0.1
secrets-tls-context: tlscontext
secrets-uds-path: /test/path/socket
user: root
1 change: 1 addition & 0 deletions testdata/cases/server64/versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"TestedVersion":"6.4.0.1","OriginallyUsedVersion":"6.4.0.1"}
1 change: 1 addition & 0 deletions testdata/cases/server64/yaml-tests.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"Source":"testdata/cases/server64/server64.yaml","Destination":"testdata/cases/server64/server64-res-.conf","Expected":"testdata/cases/server64/server64.conf","Arguments":["convert","--aerospike-version","6.4.0.1","--format","yaml","--output","testdata/cases/server64/server64-res-.conf"],"SkipServerTest":false,"ServerErrorAllowList":["each of: /proc/sys/vm/dirty_bytes"]}]

0 comments on commit d1690a8

Please sign in to comment.