summaryrefslogtreecommitdiffhomepage
path: root/modules/caddytls/capools_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddytls/capools_test.go')
-rw-r--r--modules/caddytls/capools_test.go114
1 files changed, 0 insertions, 114 deletions
diff --git a/modules/caddytls/capools_test.go b/modules/caddytls/capools_test.go
index d04354a18..67244b59a 100644
--- a/modules/caddytls/capools_test.go
+++ b/modules/caddytls/capools_test.go
@@ -567,21 +567,6 @@ func TestTLSConfig_unmarshalCaddyfile(t *testing.T) {
},
},
{
- name: "setting 'ca' to 'lazy' with appropriate block is valid",
- args: args{
- d: caddyfile.NewTestDispenser(`{
- ca lazy {
- backend file {
- pem_file /var/caddy/ca.pem
- }
- }
- }`),
- },
- expected: TLSConfig{
- CARaw: []byte(`{"ca":{"pem_files":["/var/caddy/ca.pem"],"provider":"file"},"provider":"lazy"}`),
- },
- },
- {
name: "setting 'ca' to 'file' with appropriate block is valid",
args: args{
d: caddyfile.NewTestDispenser(`{
@@ -791,102 +776,3 @@ func TestHTTPCertPoolUnmarshalCaddyfile(t *testing.T) {
})
}
}
-
-func TestLazyCertPoolUnmarshalCaddyfile(t *testing.T) {
- type args struct {
- d *caddyfile.Dispenser
- }
- tests := []struct {
- name string
- args args
- expected LazyCertPool
- wantErr bool
- }{
- {
- name: "no block results in error",
- args: args{
- d: caddyfile.NewTestDispenser(`lazy`),
- },
- wantErr: true,
- },
- {
- name: "empty block results in error",
- args: args{
- d: caddyfile.NewTestDispenser(`lazy {
- }`),
- },
- wantErr: true,
- },
- {
- name: "defining 'backend' multiple times results in error",
- args: args{
- d: caddyfile.NewTestDispenser(`lazy {
- backend http {
- endpoints http://localhost/ca-certs
- }
- backend file {
- pem_file /var/caddy/certs
- }
- }`),
- },
- wantErr: true,
- },
- {
- name: "defining 'backend' without argument results in error",
- args: args{
- d: caddyfile.NewTestDispenser(`lazy {
- backend
- }`),
- },
- wantErr: true,
- },
- {
- name: "using unrecognized directive results in error",
- args: args{
- d: caddyfile.NewTestDispenser(`lazy {
- foo
- }`),
- },
- wantErr: true,
- },
- {
- name: "defining single 'backend' is successful",
- args: args{
- d: caddyfile.NewTestDispenser(`lazy {
- backend http {
- endpoints http://localhost/ca-certs
- }
- }`),
- },
- expected: LazyCertPool{
- CARaw: []byte(`{"endpoints":["http://localhost/ca-certs"],"provider":"http"}`),
- },
- },
- {
- name: "defining single 'backend' with 'eager_validation' successful",
- args: args{
- d: caddyfile.NewTestDispenser(`lazy {
- backend file {
- pem_file /var/caddy/certs
- }
- eager_validation
- }`),
- },
- expected: LazyCertPool{
- CARaw: []byte(`{"pem_files":["/var/caddy/certs"],"provider":"file"}`),
- EagerValidation: true,
- },
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- lcp := &LazyCertPool{}
- if err := lcp.UnmarshalCaddyfile(tt.args.d); (err != nil) != tt.wantErr {
- t.Errorf("LazyCertPool.UnmarshalCaddyfile() error = %v, wantErr %v", err, tt.wantErr)
- }
- if !tt.wantErr && !reflect.DeepEqual(&tt.expected, lcp) {
- t.Errorf("LazyCertPool.UnmarshalCaddyfile() = %v, want %v", lcp, tt.expected)
- }
- })
- }
-}