Skip to content

Commit

Permalink
Added config testing (odyssey --test) (#537)
Browse files Browse the repository at this point in the history
* added configuration testing (odyssey --test)

* fixes

* fix names

* fix names

* apply fmt

* start create tests

* rebuild

* tests done

* --test no longer forks the process

* config without rules is no longer valid

* fix tests

* fix storage_type tests

* fix storage_tls tests

* fix config-examples/odyssey-aq.conf

* change .gitignore

* rm .DS_Store
  • Loading branch information
NikitaUnisikhin authored Nov 10, 2023
1 parent 5f4e64d commit 9a42394
Show file tree
Hide file tree
Showing 101 changed files with 1,709 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ docker/bin/odyssey-asan
odyssey.conf.example
odyssey.init
odyssey.logrotate
.DS_Store
2 changes: 1 addition & 1 deletion config-examples/odyssey-aq.conf
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@ locks_dir "/tmp/odyssey"

graceful_die_on_errors yes
enable_online_restart no
bindwith_reuseport yes
bindwith_reuseport yes
8 changes: 7 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ FROM golang:latest as base

RUN mkdir -p /ody-integration-test
RUN mkdir -p /prep_stmts
RUN mkdir -p /config-validation
COPY ./docker/ody-integration-test /ody-integration-test
COPY ./docker/prep_stmts /prep_stmts
COPY ./docker/config-validation /config-validation

WORKDIR /ody-integration-test

RUN go mod download && cd pkg && go build -o ody-integration-test

WORKDIR /prep_stmts
RUN go mod download && cd pkg && go build -o pstmts-test

WORKDIR /config-validation
RUN go mod download && cd pkg && go build -o config-validation

FROM ubuntu:focal

ENV DEBIAN_FRONTEND=noninteractive
Expand Down Expand Up @@ -58,9 +62,11 @@ RUN mkdir /tmp/odyssey
COPY ./docker/odyssey.conf /etc/odyssey/odyssey.conf
COPY ./docker/lagpolling/lag-conf.conf /etc/odyssey/lag-conf.conf
COPY ./docker/prep_stmts/pstmts.conf /etc/odyssey/pstmts.conf
COPY ./docker/config-validation/configs /etc/odyssey/configs

COPY --from=base /ody-integration-test/pkg/ody-integration-test /ody-integration-test
COPY --from=base /prep_stmts/pkg/pstmts-test /pstmts-test
COPY --from=base /config-validation/pkg/config-validation /config-validation
COPY ./docker/scram /scram
COPY ./docker/hba /hba
COPY ./docker/auth_query /auth_query
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
unix_socket_dir "/tmp"
unix_socket_mode "0644"

log_format "%p %t %l [%i %s] (%c) %m\n"

listen {
host "*"
}

storage "postgres_server" {
type "remote"
}

database "db" {
user "user" {
storage "postgres_server"
pool "session"
authentication "none"
auth_query "auth_query"
auth_query_db "db"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
unix_socket_dir "/tmp"
unix_socket_mode "0644"

log_format "%p %t %l [%i %s] (%c) %m\n"

listen {
host "*"
}

storage "postgres_server" {
type "remote"
}

database "db" {
user "user" {
storage "postgres_server"
pool "session"
authentication "none"
auth_query "auth_query"
auth_query_user "user"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
unix_socket_dir "/tmp"
unix_socket_mode "0644"

log_format "%p %t %l [%i %s] (%c) %m\n"

listen {
host "*"
}

storage "postgres_server" {
type "remote"
}

database "db" {
user "user" {
storage "postgres_server"
pool "session"
authentication "none"
auth_query "auth_query"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
unix_socket_dir "/tmp"
unix_socket_mode "0644"

log_format "%p %t %l [%i %s] (%c) %m\n"

listen {
host "*"
}

storage "postgres_server" {
type "remote"
}

database "db" {
user "user" {
storage "postgres_server"
pool "session"
authentication "none"
auth_query "auth_query"
auth_query_user "user"
auth_query_db "db"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
unix_socket_dir "/tmp"
unix_socket_mode "0644"

log_format "%p %t %l [%i %s] (%c) %m\n"

listen {
host "*"
}

storage "postgres_server" {
type "remote"
}

database "db" {
user "user" {
storage "postgres_server"
pool "session"
authentication "md5"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
unix_socket_dir "/tmp"
unix_socket_mode "0644"

log_format "%p %t %l [%i %s] (%c) %m\n"

listen {
host "*"
}

storage "postgres_server" {
type "remote"
}

database "db" {
user "user" {
storage "postgres_server"
pool "session"
authentication "scram-sha-256"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
unix_socket_dir "/tmp"
unix_socket_mode "0644"

log_format "%p %t %l [%i %s] (%c) %m\n"

listen {
host "*"
}

storage "postgres_server" {
type "remote"
}

database "db" {
user "user" {
storage "postgres_server"
pool "session"
authentication "kek"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
unix_socket_dir "/tmp"
unix_socket_mode "0644"

log_format "%p %t %l [%i %s] (%c) %m\n"

listen {
host "*"
}

storage "postgres_server" {
type "remote"
}

database "db" {
user "user" {
storage "postgres_server"
pool "session"
authentication "none"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
unix_socket_dir "/tmp"
unix_socket_mode "0644"

log_format "%p %t %l [%i %s] (%c) %m\n"

listen {
host "*"
}

storage "postgres_server" {
type "remote"
}

database "db" {
user "user" {
storage "postgres_server"
pool "session"
authentication "cert"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
unix_socket_dir "/tmp"
unix_socket_mode "0644"

log_format "%p %t %l [%i %s] (%c) %m\n"

listen {
host "*"
}

storage "postgres_server" {
type "remote"
}

database "db" {
user "user" {
storage "postgres_server"
pool "session"
authentication "block"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
unix_socket_dir "/tmp"
unix_socket_mode "0644"

log_format "%p %t %l [%i %s] (%c) %m\n"

listen {
host "*"
}

storage "postgres_server" {
type "remote"
}

database "db" {
user "user" {
storage "postgres_server"
pool "session"
authentication "clear_text"
password "password"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
unix_socket_dir "/tmp"
unix_socket_mode "0644"

log_format "%p %t %l [%i %s] (%c) %m\n"

listen {
host "*"
}

storage "postgres_server" {
type "remote"
}

database "db" {
user "user" {
storage "postgres_server"
pool "session"
authentication "md5"
password "password"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
unix_socket_dir "/tmp"
unix_socket_mode "0644"

log_format "%p %t %l [%i %s] (%c) %m\n"

listen {
host "*"
}

storage "postgres_server" {
type "remote"
}

database "db" {
user "user" {
storage "postgres_server"
pool "session"
authentication "md5"
auth_query "auth_query"
auth_query_user "user"
auth_query_db "db"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
unix_socket_dir "/tmp"
unix_socket_mode "0644"

log_format "%p %t %l [%i %s] (%c) %m\n"

listen {
host "*"
}

storage "postgres_server" {
type "remote"
}

database "db" {
user "user" {
storage "postgres_server"
pool "session"
authentication "scram-sha-256"
auth_query "auth_query"
auth_query_user "user"
auth_query_db "db"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
unix_socket_dir "/tmp"
unix_socket_mode "0644"

log_format "%p %t %l [%i %s] (%c) %m\n"

listen {
host "*"
}

storage "postgres_server" {
type "remote"
}

database "db" {
user "user" {
storage "postgres_server"
pool "session"
authentication "scram-sha-256"
password "password"
}
}
Loading

0 comments on commit 9a42394

Please sign in to comment.