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
|
LeasingProvisionedThroughputError ErrorCode = 41203
|
||||||
|
|
||||||
// Misc Errors 41300 - 41400
|
// Misc Errors 41300 - 41400
|
||||||
// NotImplemented
|
// NotImplemented
|
||||||
KinesisClientLibNotImplemented ErrorCode = 41301
|
KinesisClientLibNotImplemented ErrorCode = 41301
|
||||||
|
|
||||||
// Error indicates passing illegal or inappropriate argument
|
// Error indicates passing illegal or inappropriate argument
|
||||||
IllegalArgumentError ErrorCode = 41302
|
IllegalArgumentError ErrorCode = 41302
|
||||||
)
|
)
|
||||||
|
|
||||||
var errorMap = map[ErrorCode]ClientLibraryError{
|
var errorMap = map[ErrorCode]ClientLibraryError{
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ type (
|
||||||
SkipShardSyncAtWorkerInitializationIfLeasesExist bool
|
SkipShardSyncAtWorkerInitializationIfLeasesExist bool
|
||||||
|
|
||||||
// The max number of threads in the worker thread pool to getRecords.
|
// 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")
|
WithRegionName("us-west-2")
|
||||||
|
|
||||||
assert.Equal(t, "appName", kclConfig.ApplicationName)
|
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
|
// populate the KCL configuration with default values
|
||||||
return &KinesisClientLibConfiguration{
|
return &KinesisClientLibConfiguration{
|
||||||
ApplicationName: applicationName,
|
ApplicationName: applicationName,
|
||||||
TableName: applicationName,
|
TableName: applicationName,
|
||||||
StreamName: streamName,
|
StreamName: streamName,
|
||||||
WorkerID: workerID,
|
WorkerID: workerID,
|
||||||
KinesisEndpoint: "",
|
KinesisEndpoint: "",
|
||||||
InitialPositionInStream: DEFAULT_INITIAL_POSITION_IN_STREAM,
|
InitialPositionInStream: DEFAULT_INITIAL_POSITION_IN_STREAM,
|
||||||
InitialPositionInStreamExtended: *newInitialPosition(DEFAULT_INITIAL_POSITION_IN_STREAM),
|
InitialPositionInStreamExtended: *newInitialPosition(DEFAULT_INITIAL_POSITION_IN_STREAM),
|
||||||
FailoverTimeMillis: DEFAULT_FAILOVER_TIME_MILLIS,
|
FailoverTimeMillis: DEFAULT_FAILOVER_TIME_MILLIS,
|
||||||
|
|
@ -29,12 +29,12 @@ func NewKinesisClientLibConfig(applicationName, streamName, workerID string) *Ki
|
||||||
IdleTimeBetweenReadsInMillis: DEFAULT_IDLETIME_BETWEEN_READS_MILLIS,
|
IdleTimeBetweenReadsInMillis: DEFAULT_IDLETIME_BETWEEN_READS_MILLIS,
|
||||||
CallProcessRecordsEvenForEmptyRecordList: DEFAULT_DONT_CALL_PROCESS_RECORDS_FOR_EMPTY_RECORD_LIST,
|
CallProcessRecordsEvenForEmptyRecordList: DEFAULT_DONT_CALL_PROCESS_RECORDS_FOR_EMPTY_RECORD_LIST,
|
||||||
ParentShardPollIntervalMillis: DEFAULT_PARENT_SHARD_POLL_INTERVAL_MILLIS,
|
ParentShardPollIntervalMillis: DEFAULT_PARENT_SHARD_POLL_INTERVAL_MILLIS,
|
||||||
ShardSyncIntervalMillis: DEFAULT_SHARD_SYNC_INTERVAL_MILLIS,
|
ShardSyncIntervalMillis: DEFAULT_SHARD_SYNC_INTERVAL_MILLIS,
|
||||||
CleanupTerminatedShardsBeforeExpiry: DEFAULT_CLEANUP_LEASES_UPON_SHARDS_COMPLETION,
|
CleanupTerminatedShardsBeforeExpiry: DEFAULT_CLEANUP_LEASES_UPON_SHARDS_COMPLETION,
|
||||||
TaskBackoffTimeMillis: DEFAULT_TASK_BACKOFF_TIME_MILLIS,
|
TaskBackoffTimeMillis: DEFAULT_TASK_BACKOFF_TIME_MILLIS,
|
||||||
MetricsBufferTimeMillis: DEFAULT_METRICS_BUFFER_TIME_MILLIS,
|
MetricsBufferTimeMillis: DEFAULT_METRICS_BUFFER_TIME_MILLIS,
|
||||||
MetricsMaxQueueSize: DEFAULT_METRICS_MAX_QUEUE_SIZE,
|
MetricsMaxQueueSize: DEFAULT_METRICS_MAX_QUEUE_SIZE,
|
||||||
ValidateSequenceNumberBeforeCheckpointing: DEFAULT_VALIDATE_SEQUENCE_NUMBER_BEFORE_CHECKPOINTING,
|
ValidateSequenceNumberBeforeCheckpointing: DEFAULT_VALIDATE_SEQUENCE_NUMBER_BEFORE_CHECKPOINTING,
|
||||||
RegionName: "",
|
RegionName: "",
|
||||||
ShutdownGraceMillis: DEFAULT_SHUTDOWN_GRACE_MILLIS,
|
ShutdownGraceMillis: DEFAULT_SHUTDOWN_GRACE_MILLIS,
|
||||||
MaxLeasesForWorker: DEFAULT_MAX_LEASES_FOR_WORKER,
|
MaxLeasesForWorker: DEFAULT_MAX_LEASES_FOR_WORKER,
|
||||||
|
|
@ -42,7 +42,7 @@ func NewKinesisClientLibConfig(applicationName, streamName, workerID string) *Ki
|
||||||
InitialLeaseTableReadCapacity: DEFAULT_INITIAL_LEASE_TABLE_READ_CAPACITY,
|
InitialLeaseTableReadCapacity: DEFAULT_INITIAL_LEASE_TABLE_READ_CAPACITY,
|
||||||
InitialLeaseTableWriteCapacity: DEFAULT_INITIAL_LEASE_TABLE_WRITE_CAPACITY,
|
InitialLeaseTableWriteCapacity: DEFAULT_INITIAL_LEASE_TABLE_WRITE_CAPACITY,
|
||||||
SkipShardSyncAtWorkerInitializationIfLeasesExist: DEFAULT_SKIP_SHARD_SYNC_AT_STARTUP_IF_LEASES_EXIST,
|
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
|
// WithWorkerThreadPoolSize configures worker thread pool size
|
||||||
func (c *KinesisClientLibConfiguration) WithWorkerThreadPoolSize(n int) *KinesisClientLibConfiguration {
|
func (c *KinesisClientLibConfiguration) WithWorkerThreadPoolSize(n int) *KinesisClientLibConfiguration {
|
||||||
checkIsValuePositive("WorkerThreadPoolSize", n)
|
checkIsValuePositive("WorkerThreadPoolSize", n)
|
||||||
c.WorkerThreadPoolSize = n
|
c.WorkerThreadPoolSize = n
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
package types
|
package interfaces
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
ks "github.com/aws/aws-sdk-go/service/kinesis"
|
ks "github.com/aws/aws-sdk-go/service/kinesis"
|
||||||
|
|
||||||
. "clientlibrary/interfaces"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -2,8 +2,6 @@ package interfaces
|
||||||
|
|
||||||
import (
|
import (
|
||||||
ks "github.com/aws/aws-sdk-go/service/kinesis"
|
ks "github.com/aws/aws-sdk-go/service/kinesis"
|
||||||
|
|
||||||
. "clientlibrary/types"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
package interfaces
|
package interfaces
|
||||||
|
|
||||||
import (
|
|
||||||
. "clientlibrary/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
// IRecordProcessor is the interface for some callback functions invoked by KCL will
|
// 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.
|
// 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
|
// 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.
|
// ExtendedSequenceNumber represents a two-part sequence number for records aggregated by the Kinesis Producer Library.
|
||||||
//
|
//
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package checkpoint
|
package checkpoint
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "clientlibrary/types"
|
. "clientlibrary/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package impl
|
package impl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "clientlibrary/types"
|
. "clientlibrary/interfaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
// KinesisClientLease is a Lease subclass containing KinesisClientLibrary related fields for checkpoints.
|
// KinesisClientLease is a Lease subclass containing KinesisClientLibrary related fields for checkpoints.
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ local_go_pkgs() {
|
||||||
grep -Fv '/tmp/' | \
|
grep -Fv '/tmp/' | \
|
||||||
grep -Fv '/run/' | \
|
grep -Fv '/run/' | \
|
||||||
grep -Fv '/tests/' | \
|
grep -Fv '/tests/' | \
|
||||||
|
sed -r 's|(.+)/[^/]+\.go$|\1|g' | \
|
||||||
sort -u
|
sort -u
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue