-
Notifications
You must be signed in to change notification settings - Fork 16
/
expiration_operation_test.go
42 lines (32 loc) · 1.18 KB
/
expiration_operation_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package tests
import (
"github.com/ravendb/ravendb-go-client"
"github.com/stretchr/testify/assert"
"testing"
)
func expirationConfigurationOperation(t *testing.T, driver *RavenTestDriver) {
store := driver.getDocumentStoreMust(t)
defer store.Close()
configureExpiration := ravendb.ExpirationConfiguration{
Disabled: false,
}
opExpiration, err := ravendb.NewConfigureExpirationOperationWithConfiguration(&configureExpiration)
assert.NoError(t, err)
err = store.Maintenance().Send(opExpiration)
assert.NoError(t, err)
lastRaftEtag := *opExpiration.Command.Result.RaftCommandIndex
assert.NotNil(t, lastRaftEtag)
var deleteFrequency int64 = 60
opExpiration, err = ravendb.NewConfigureExpirationOperation(false, &deleteFrequency, nil)
assert.NoError(t, err)
err = store.Maintenance().Send(opExpiration)
assert.NoError(t, err)
assert.NotNil(t, *opExpiration.Command.Result.RaftCommandIndex)
assert.NotEqual(t, lastRaftEtag, *opExpiration.Command.Result.RaftCommandIndex)
}
func TestExpirationConfiguration(t *testing.T) {
driver := createTestDriver(t)
destroy := func() { destroyDriver(t, driver) }
defer recoverTest(t, destroy)
expirationConfigurationOperation(t, driver)
}