Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: tools-2616 tools-2648 support server 6.4 configs #15

Merged
merged 8 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-20230816205303-06c8e66a7feb
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
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ 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/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"]}]
67 changes: 67 additions & 0 deletions testdata/cases/server64/server64.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

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
}
Comment on lines +51 to +55
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to test sindex-type flash too since that is new in 6.4

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion, sindex-type wasn't being parsed, I've added it to the management lib and this test.


storage-engine device {

device /dummy/device1
device /dummy/device2


write-block-size 128K


}
}
43 changes: 43 additions & 0 deletions testdata/cases/server64/server64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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
storage-engine:
devices:
- /dummy/device1
- /dummy/device2
type: device
write-block-size: 131072
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"]}]