forked from ryandotsmith/ddbsync
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ability to wait between Lock attempts
This should stop clients from hammering Dynamo while waiting for a lock. Also: * Now only attempt to release a lock 3 times * Tidied up the tests and moved away from Testify Suite
- Loading branch information
Showing
7 changed files
with
113 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
package: github.com/zencoder/ddbsync | ||
import: | ||
- package: github.com/aws/aws-sdk-go | ||
version: v1.7.9 | ||
version: v0.10.4 | ||
subpackages: | ||
- aws | ||
- internal/endpoints | ||
- internal/protocol/json/jsonutil | ||
- internal/protocol/jsonrpc | ||
- internal/protocol/rest | ||
- internal/signer/v4 | ||
- service/dynamodb | ||
- package: github.com/stretchr/objx | ||
version: cbeaeb16a013161a98496fad62933b1d21786672 | ||
- package: github.com/stretchr/testify | ||
version: v1.1.4 | ||
version: c478a808a1b37e10c82f71a2172728f8742bad51 | ||
subpackages: | ||
- assert | ||
- mock | ||
- require | ||
- suite | ||
- package: github.com/vaughan0/go-ini | ||
version: a98ad7ee00ec53921f08832bc06ecf7fd600e6a1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
package ddbsync | ||
|
||
import ( | ||
"github.com/stretchr/testify/require" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/suite" | ||
"testing" | ||
) | ||
|
||
const LOCK_SERVICE_VALID_MUTEX_NAME string = "mut-test" | ||
const LOCK_SERVICE_VALID_MUTEX_TTL int64 = 4 | ||
|
||
func TestNewLock(t *testing.T) { | ||
type LockServiceSuite struct { | ||
suite.Suite | ||
} | ||
|
||
func TestLockServiceSuite(t *testing.T) { | ||
suite.Run(t, new(LockServiceSuite)) | ||
} | ||
|
||
func (s *LockServiceSuite) TestNewLock() { | ||
ls := &LockService{} | ||
m := ls.NewLock(LOCK_SERVICE_VALID_MUTEX_NAME, LOCK_SERVICE_VALID_MUTEX_TTL) | ||
|
||
require.NotNil(t, ls) | ||
require.NotNil(t, m) | ||
require.IsType(t, &LockService{}, ls) | ||
require.IsType(t, &Mutex{}, m) | ||
require.Equal(t, &Mutex{Name: LOCK_SERVICE_VALID_MUTEX_NAME, TTL: LOCK_SERVICE_VALID_MUTEX_TTL}, m) | ||
assert.NotNil(s.T(), ls) | ||
assert.NotNil(s.T(), m) | ||
assert.IsType(s.T(), &LockService{}, ls) | ||
assert.IsType(s.T(), &Mutex{}, m) | ||
assert.Equal(s.T(), &Mutex{Name: LOCK_SERVICE_VALID_MUTEX_NAME, TTL: LOCK_SERVICE_VALID_MUTEX_TTL}, m) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.