KCL: Fix unit test
Fix code bug for removing cyclic dependency and fix unit test. Test: hmake test Change-Id: Ib4d4ba416d0133542e6459459ddf43079ff53ab8
This commit is contained in:
parent
425daf70ce
commit
1969713863
11 changed files with 26 additions and 34 deletions
|
|
@ -35,11 +35,11 @@ const (
|
|||
LeasingProvisionedThroughputError ErrorCode = 41203
|
||||
|
||||
// Misc Errors 41300 - 41400
|
||||
// NotImplemented
|
||||
KinesisClientLibNotImplemented ErrorCode = 41301
|
||||
// NotImplemented
|
||||
KinesisClientLibNotImplemented ErrorCode = 41301
|
||||
|
||||
// Error indicates passing illegal or inappropriate argument
|
||||
IllegalArgumentError ErrorCode = 41302
|
||||
// Error indicates passing illegal or inappropriate argument
|
||||
IllegalArgumentError ErrorCode = 41302
|
||||
)
|
||||
|
||||
var errorMap = map[ErrorCode]ClientLibraryError{
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ type (
|
|||
SkipShardSyncAtWorkerInitializationIfLeasesExist bool
|
||||
|
||||
// The max number of threads in the worker thread pool to getRecords.
|
||||
WorkerThreadPoolSize int
|
||||
WorkerThreadPoolSize int
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -19,5 +19,5 @@ func TestConfig(t *testing.T) {
|
|||
WithRegionName("us-west-2")
|
||||
|
||||
assert.Equal(t, "appName", kclConfig.ApplicationName)
|
||||
assert.Equal(t, "500", kclConfig.FailoverTimeMillis)
|
||||
assert.Equal(t, 500, kclConfig.FailoverTimeMillis)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@ func NewKinesisClientLibConfig(applicationName, streamName, workerID string) *Ki
|
|||
|
||||
// populate the KCL configuration with default values
|
||||
return &KinesisClientLibConfiguration{
|
||||
ApplicationName: applicationName,
|
||||
TableName: applicationName,
|
||||
StreamName: streamName,
|
||||
WorkerID: workerID,
|
||||
KinesisEndpoint: "",
|
||||
ApplicationName: applicationName,
|
||||
TableName: applicationName,
|
||||
StreamName: streamName,
|
||||
WorkerID: workerID,
|
||||
KinesisEndpoint: "",
|
||||
InitialPositionInStream: DEFAULT_INITIAL_POSITION_IN_STREAM,
|
||||
InitialPositionInStreamExtended: *newInitialPosition(DEFAULT_INITIAL_POSITION_IN_STREAM),
|
||||
FailoverTimeMillis: DEFAULT_FAILOVER_TIME_MILLIS,
|
||||
|
|
@ -29,12 +29,12 @@ func NewKinesisClientLibConfig(applicationName, streamName, workerID string) *Ki
|
|||
IdleTimeBetweenReadsInMillis: DEFAULT_IDLETIME_BETWEEN_READS_MILLIS,
|
||||
CallProcessRecordsEvenForEmptyRecordList: DEFAULT_DONT_CALL_PROCESS_RECORDS_FOR_EMPTY_RECORD_LIST,
|
||||
ParentShardPollIntervalMillis: DEFAULT_PARENT_SHARD_POLL_INTERVAL_MILLIS,
|
||||
ShardSyncIntervalMillis: DEFAULT_SHARD_SYNC_INTERVAL_MILLIS,
|
||||
CleanupTerminatedShardsBeforeExpiry: DEFAULT_CLEANUP_LEASES_UPON_SHARDS_COMPLETION,
|
||||
TaskBackoffTimeMillis: DEFAULT_TASK_BACKOFF_TIME_MILLIS,
|
||||
MetricsBufferTimeMillis: DEFAULT_METRICS_BUFFER_TIME_MILLIS,
|
||||
MetricsMaxQueueSize: DEFAULT_METRICS_MAX_QUEUE_SIZE,
|
||||
ValidateSequenceNumberBeforeCheckpointing: DEFAULT_VALIDATE_SEQUENCE_NUMBER_BEFORE_CHECKPOINTING,
|
||||
ShardSyncIntervalMillis: DEFAULT_SHARD_SYNC_INTERVAL_MILLIS,
|
||||
CleanupTerminatedShardsBeforeExpiry: DEFAULT_CLEANUP_LEASES_UPON_SHARDS_COMPLETION,
|
||||
TaskBackoffTimeMillis: DEFAULT_TASK_BACKOFF_TIME_MILLIS,
|
||||
MetricsBufferTimeMillis: DEFAULT_METRICS_BUFFER_TIME_MILLIS,
|
||||
MetricsMaxQueueSize: DEFAULT_METRICS_MAX_QUEUE_SIZE,
|
||||
ValidateSequenceNumberBeforeCheckpointing: DEFAULT_VALIDATE_SEQUENCE_NUMBER_BEFORE_CHECKPOINTING,
|
||||
RegionName: "",
|
||||
ShutdownGraceMillis: DEFAULT_SHUTDOWN_GRACE_MILLIS,
|
||||
MaxLeasesForWorker: DEFAULT_MAX_LEASES_FOR_WORKER,
|
||||
|
|
@ -42,7 +42,7 @@ func NewKinesisClientLibConfig(applicationName, streamName, workerID string) *Ki
|
|||
InitialLeaseTableReadCapacity: DEFAULT_INITIAL_LEASE_TABLE_READ_CAPACITY,
|
||||
InitialLeaseTableWriteCapacity: DEFAULT_INITIAL_LEASE_TABLE_WRITE_CAPACITY,
|
||||
SkipShardSyncAtWorkerInitializationIfLeasesExist: DEFAULT_SKIP_SHARD_SYNC_AT_STARTUP_IF_LEASES_EXIST,
|
||||
WorkerThreadPoolSize: 1,
|
||||
WorkerThreadPoolSize: 1,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -147,8 +147,7 @@ func (c *KinesisClientLibConfiguration) WithRegionName(regionName string) *Kines
|
|||
|
||||
// WithWorkerThreadPoolSize configures worker thread pool size
|
||||
func (c *KinesisClientLibConfiguration) WithWorkerThreadPoolSize(n int) *KinesisClientLibConfiguration {
|
||||
checkIsValuePositive("WorkerThreadPoolSize", n)
|
||||
c.WorkerThreadPoolSize = n
|
||||
return c
|
||||
checkIsValuePositive("WorkerThreadPoolSize", n)
|
||||
c.WorkerThreadPoolSize = n
|
||||
return c
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
package types
|
||||
package interfaces
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
ks "github.com/aws/aws-sdk-go/service/kinesis"
|
||||
|
||||
. "clientlibrary/interfaces"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -2,8 +2,6 @@ package interfaces
|
|||
|
||||
import (
|
||||
ks "github.com/aws/aws-sdk-go/service/kinesis"
|
||||
|
||||
. "clientlibrary/types"
|
||||
)
|
||||
|
||||
type (
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
package interfaces
|
||||
|
||||
import (
|
||||
. "clientlibrary/types"
|
||||
)
|
||||
|
||||
// IRecordProcessor is the interface for some callback functions invoked by KCL will
|
||||
// The main task of using KCL is to provide implementation on IRecordProcessor interface.
|
||||
// Note: This is exactly the same interface as Amazon KCL IRecordProcessor v2
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package types
|
||||
package interfaces
|
||||
|
||||
// ExtendedSequenceNumber represents a two-part sequence number for records aggregated by the Kinesis Producer Library.
|
||||
//
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package checkpoint
|
||||
|
||||
import (
|
||||
. "clientlibrary/types"
|
||||
. "clientlibrary/interfaces"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package impl
|
||||
|
||||
import (
|
||||
. "clientlibrary/types"
|
||||
. "clientlibrary/interfaces"
|
||||
)
|
||||
|
||||
// KinesisClientLease is a Lease subclass containing KinesisClientLibrary related fields for checkpoints.
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ local_go_pkgs() {
|
|||
grep -Fv '/tmp/' | \
|
||||
grep -Fv '/run/' | \
|
||||
grep -Fv '/tests/' | \
|
||||
sed -r 's|(.+)/[^/]+\.go$|\1|g' | \
|
||||
sort -u
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue