(t *testing.T)
| 99 | } |
| 100 | |
| 101 | func TestPostgresParameters(t *testing.T) { |
| 102 | t.Run("Zero", func(t *testing.T) { |
| 103 | result := PostgresParameters(nil) |
| 104 | |
| 105 | assert.Assert(t, result != nil) |
| 106 | assert.DeepEqual(t, result.AsMap(), map[string]string{}) |
| 107 | }) |
| 108 | |
| 109 | t.Run("NoDynamicConfig", func(t *testing.T) { |
| 110 | spec := new(v1beta1.PatroniSpec) |
| 111 | result := PostgresParameters(spec) |
| 112 | |
| 113 | assert.Assert(t, result != nil) |
| 114 | assert.DeepEqual(t, result.AsMap(), map[string]string{}) |
| 115 | }) |
| 116 | |
| 117 | t.Run("NoPostgreSQL", func(t *testing.T) { |
| 118 | spec := new(v1beta1.PatroniSpec) |
| 119 | require.UnmarshalInto(t, spec, `{ |
| 120 | dynamicConfiguration: {}, |
| 121 | }`) |
| 122 | result := PostgresParameters(spec) |
| 123 | |
| 124 | assert.Assert(t, result != nil) |
| 125 | assert.DeepEqual(t, result.AsMap(), map[string]string{}) |
| 126 | }) |
| 127 | |
| 128 | t.Run("WrongPostgreSQLType", func(t *testing.T) { |
| 129 | spec := new(v1beta1.PatroniSpec) |
| 130 | require.UnmarshalInto(t, spec, `{ |
| 131 | dynamicConfiguration: { |
| 132 | postgresql: asdf, |
| 133 | }, |
| 134 | }`) |
| 135 | result := PostgresParameters(spec) |
| 136 | |
| 137 | assert.Assert(t, result != nil) |
| 138 | assert.DeepEqual(t, result.AsMap(), map[string]string{}) |
| 139 | }) |
| 140 | |
| 141 | t.Run("NoParameters", func(t *testing.T) { |
| 142 | spec := new(v1beta1.PatroniSpec) |
| 143 | require.UnmarshalInto(t, spec, `{ |
| 144 | dynamicConfiguration: { |
| 145 | postgresql: { |
| 146 | use_pg_rewind: true, |
| 147 | }, |
| 148 | }, |
| 149 | }`) |
| 150 | result := PostgresParameters(spec) |
| 151 | |
| 152 | assert.Assert(t, result != nil) |
| 153 | assert.DeepEqual(t, result.AsMap(), map[string]string{}) |
| 154 | }) |
| 155 | |
| 156 | t.Run("WrongParametersType", func(t *testing.T) { |
| 157 | spec := new(v1beta1.PatroniSpec) |
| 158 | require.UnmarshalInto(t, spec, `{ |
nothing calls this directly
no test coverage detected