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

refactor: add Validate() and Check() #186

Merged
merged 2 commits into from
Sep 27, 2024
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apis/v1alpha1/defaulting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

func TestClusterSetDefaults(t *testing.T) {
const (
testDir = "testdata/greptimedbcluster"
testDir = "testdata/defaulting/greptimedbcluster"
inputFileName = "input.yaml"
expectFileName = "expect.yaml"
)
Expand Down Expand Up @@ -86,7 +86,7 @@ func TestClusterSetDefaults(t *testing.T) {

func TestStandaloneSetDefaults(t *testing.T) {
const (
testDir = "testdata/greptimedbstandalone"
testDir = "testdata/defaulting/greptimedbstandalone"
inputFileName = "input.yaml"
expectFileName = "expect.yaml"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: greptime.io/v1alpha1
kind: GreptimeDBCluster
metadata:
name: test00
namespace: default
spec:
base:
main:
image: greptime/greptimedb:latest
frontend:
replicas: 1
meta:
etcdEndpoints:
- etcd.etcd-cluster.svc.cluster.local:2379
replicas: 1
datanode:
replicas: 3
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: greptime.io/v1alpha1
kind: GreptimeDBCluster
metadata:
name: test01-error
namespace: default
spec:
base:
main:
image: greptime/greptimedb:latest
frontend:
replicas: 1
# This is an error because the config is not a valid toml config.
config: |
It's not a valid toml config----
meta:
etcdEndpoints:
- etcd.etcd-cluster.svc.cluster.local:2379
replicas: 1
datanode:
replicas: 3
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: greptime.io/v1alpha1
kind: GreptimeDBCluster
metadata:
name: test02-error
namespace: default
spec:
base:
main:
image: greptime/greptimedb:latest
frontend:
replicas: 1
meta:
etcdEndpoints:
- etcd.etcd-cluster.svc.cluster.local:2379
replicas: 1
datanode:
replicas: 3
# This is an error because multiple objectStorage configs are not allowed.
objectStorage:
s3:
bucket: "greptimedb"
oss:
bucket: "greptimedb"
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: greptime.io/v1alpha1
kind: GreptimeDBCluster
metadata:
name: test03-error
namespace: default
spec:
base:
main:
image: greptime/greptimedb:latest
frontend:
replicas: 1
meta:
etcdEndpoints:
- etcd.etcd-cluster.svc.cluster.local:2379
replicas: 1
datanode:
replicas: 3
wal:
# This is an error because multiple wal configs are not allowed.
raftEngine:
fs:
storageClassName: io2 # Use io2 storage class for WAL for better performance.
name: wal
storageSize: 5Gi
mountPath: /wal
kafka:
brokerEndpoints:
- "kafka-bootstrap.kafka.svc.cluster.local:9092"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: greptime.io/v1alpha1
kind: GreptimeDBStandalone
metadata:
name: test00
namespace: default
spec:
base:
main:
image: greptime/greptimedb:latest
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: greptime.io/v1alpha1
kind: GreptimeDBStandalone
metadata:
name: test00-error
namespace: default
spec:
base:
main:
image: greptime/greptimedb:latest
# This is an error because the config is not a valid toml config.
config: |
It's not a valid toml config----
Loading
Loading