mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-25 09:54:47 +01:00
30cdc1430e
This commit - adds a configuration in which no step holds, replication cursors, etc. are created - removes the send.step_holds.disable_incremental setting - creates a new config option `replication` for active-side jobs - adds the replication.protection.{initial,incremental} settings, each of which can have values - `guarantee_resumability` - `guarantee_incremental` - `guarantee_nothing` (refer to docs/configuration/replication.rst for semantics) The `replication` config from an active side is sent to both endpoint.Sender and endpoint.Receiver for each replication step. Sender and Receiver then act accordingly. For `guarantee_incremental`, we add the new `tentative-replication-cursor` abstraction. The necessity for that abstraction is outlined in https://github.com/zrepl/zrepl/issues/340. fixes https://github.com/zrepl/zrepl/issues/340
75 lines
1.4 KiB
Go
75 lines
1.4 KiB
Go
package config
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestSendOptions(t *testing.T) {
|
|
tmpl := `
|
|
jobs:
|
|
- name: foo
|
|
type: push
|
|
connect:
|
|
type: local
|
|
listener_name: foo
|
|
client_identity: bar
|
|
filesystems: {"<": true}
|
|
%s
|
|
snapshotting:
|
|
type: manual
|
|
pruning:
|
|
keep_sender:
|
|
- type: last_n
|
|
count: 10
|
|
keep_receiver:
|
|
- type: last_n
|
|
count: 10
|
|
`
|
|
encrypted_false := `
|
|
send:
|
|
encrypted: false
|
|
`
|
|
|
|
encrypted_true := `
|
|
send:
|
|
encrypted: true
|
|
`
|
|
|
|
encrypted_unspecified := `
|
|
send: {}
|
|
`
|
|
|
|
send_not_specified := `
|
|
`
|
|
|
|
fill := func(s string) string { return fmt.Sprintf(tmpl, s) }
|
|
var c *Config
|
|
|
|
t.Run("encrypted_false", func(t *testing.T) {
|
|
c = testValidConfig(t, fill(encrypted_false))
|
|
encrypted := c.Jobs[0].Ret.(*PushJob).Send.Encrypted
|
|
assert.Equal(t, false, encrypted)
|
|
})
|
|
t.Run("encrypted_true", func(t *testing.T) {
|
|
c = testValidConfig(t, fill(encrypted_true))
|
|
encrypted := c.Jobs[0].Ret.(*PushJob).Send.Encrypted
|
|
assert.Equal(t, true, encrypted)
|
|
})
|
|
|
|
t.Run("encrypted_unspecified", func(t *testing.T) {
|
|
c = testValidConfig(t, fill(encrypted_unspecified))
|
|
encrypted := c.Jobs[0].Ret.(*PushJob).Send.Encrypted
|
|
assert.Equal(t, false, encrypted)
|
|
})
|
|
|
|
t.Run("send_not_specified", func(t *testing.T) {
|
|
c, err := testConfig(t, fill(send_not_specified))
|
|
assert.NoError(t, err)
|
|
assert.NotNil(t, c)
|
|
})
|
|
|
|
}
|