@@ -50,7 +50,8 @@ type SampleConfig struct {
5050 SQSClient * SQSClientConfig `json:"sqs_client,omitempty"`
5151 DynamoDBTable * DynamoDBTableConfig `json:"dynamodb_table,omitempty"`
5252 DynamoDBClient * DynamoDBClientConfig `json:"dynamodb_client,omitempty"`
53- Str * string `json:"str,omitempty"`
53+ Str string `json:"str,omitempty"`
54+ StrPointer * string `json:"str_pointer,omitempty"`
5455 StorageConfig * StorageConfig `json:"storage_config,omitempty"`
5556 StorageConfigSlice []* StorageConfig `json:"storage_config_slice,omitempty"`
5657 StorageConfigMap map [string ]* StorageConfig `json:"storage_config_map,omitempty"`
@@ -79,6 +80,7 @@ var validConfigJSON = `
7980 "table_name" : "testTable"
8081 },
8182 "str" : "testStr",
83+ "str_pointer" : "testStr",
8284 "storage_config" : {
8385 "provider" : "aws",
8486 "location" : "us-west-2"
@@ -151,7 +153,8 @@ func (s *RemoteConfigSuite) TestValidateConfigWithReflectionWithOptional() {
151153 SQSClient : sqsClient ,
152154 DynamoDBTable : dynamodbTable ,
153155 DynamoDBClient : dynamodbClient ,
154- Str : & str ,
156+ Str : str ,
157+ StrPointer : & str ,
155158 StorageConfig : storageConfig ,
156159 StorageConfigSlice : []* StorageConfig {storageConfig },
157160 StorageConfigMap : map [string ]* StorageConfig {"one" : storageConfig },
@@ -348,12 +351,52 @@ func (s *RemoteConfigSuite) TestValidateConfigWithReflectionErrorStrNotSet() {
348351 SQSClient : sqsClient ,
349352 DynamoDBTable : dynamodbTable ,
350353 DynamoDBClient : dynamodbClient ,
351- Str : nil ,
354+ Str : "testString" ,
355+ StrPointer : nil ,
352356 }
353357
354358 err := validateConfigWithReflection (c )
355359 assert .NotNil (s .T (), err )
356- assert .Equal (s .T (), errors .New ("Field: Str, not set" ), err )
360+ assert .Equal (s .T (), errors .New ("Field: StrPointer, not set" ), err )
361+ }
362+
363+ func (s * RemoteConfigSuite ) TestValidateConfigWithReflectionErrorStrPointerEmpty () {
364+ sqsRegion := VALID_REMOTE_CONFIG_SQS_REGION
365+ sqsAWSAccountID := VALID_REMOTE_CONFIG_SQS_AWS_ACCOUNT_ID
366+ sqsQueueName := VALID_REMOTE_CONFIG_SQS_QUEUE_NAME
367+ sqsQueue := & SQSQueueConfig {
368+ Region : & sqsRegion ,
369+ AWSAccountID : & sqsAWSAccountID ,
370+ QueueName : & sqsQueueName ,
371+ }
372+ sqsClient := & SQSClientConfig {
373+ Region : & sqsRegion ,
374+ }
375+
376+ dynamodbTableName := VALID_REMOTE_CONFIG_DYNAMODB_TABLE_NAME
377+ dynamodbTable := & DynamoDBTableConfig {
378+ TableName : & dynamodbTableName ,
379+ }
380+
381+ dynamodbClientRegion := VALID_REMOTE_CONFIG_DYNAMODB_CLIENT_REGION
382+ dynamodbClient := & DynamoDBClientConfig {
383+ Region : & dynamodbClientRegion ,
384+ }
385+
386+ str := ""
387+
388+ c := & SampleConfig {
389+ SQSQueue : sqsQueue ,
390+ SQSClient : sqsClient ,
391+ DynamoDBTable : dynamodbTable ,
392+ DynamoDBClient : dynamodbClient ,
393+ Str : "testString" ,
394+ StrPointer : & str ,
395+ }
396+
397+ err := validateConfigWithReflection (c )
398+ assert .NotNil (s .T (), err )
399+ assert .Equal (s .T (), errors .New ("String Field: StrPointer, contains an empty string" ), err )
357400}
358401
359402func (s * RemoteConfigSuite ) TestValidateConfigWithReflectionErrorStrEmpty () {
@@ -386,7 +429,7 @@ func (s *RemoteConfigSuite) TestValidateConfigWithReflectionErrorStrEmpty() {
386429 SQSClient : sqsClient ,
387430 DynamoDBTable : dynamodbTable ,
388431 DynamoDBClient : dynamodbClient ,
389- Str : & str ,
432+ Str : str ,
390433 }
391434
392435 err := validateConfigWithReflection (c )
@@ -424,7 +467,8 @@ func (s *RemoteConfigSuite) TestValidateConfigWithReflectionErrorStorageConfigNo
424467 SQSClient : sqsClient ,
425468 DynamoDBTable : dynamodbTable ,
426469 DynamoDBClient : dynamodbClient ,
427- Str : & str ,
470+ Str : str ,
471+ StrPointer : & str ,
428472 StorageConfig : nil ,
429473 }
430474
@@ -470,7 +514,8 @@ func (s *RemoteConfigSuite) TestValidateConfigWithReflectionErrorStorageConfigSl
470514 SQSClient : sqsClient ,
471515 DynamoDBTable : dynamodbTable ,
472516 DynamoDBClient : dynamodbClient ,
473- Str : & str ,
517+ Str : str ,
518+ StrPointer : & str ,
474519 StorageConfig : storageConfig ,
475520 StorageConfigSlice : nil ,
476521 }
@@ -549,7 +594,8 @@ func (s *RemoteConfigSuite) TestValidateConfigWithReflectionErrorStorageConfigSl
549594 SQSClient : sqsClient ,
550595 DynamoDBTable : dynamodbTable ,
551596 DynamoDBClient : dynamodbClient ,
552- Str : & str ,
597+ Str : str ,
598+ StrPointer : & str ,
553599 StorageConfig : storageConfig ,
554600 StorageConfigSlice : []* StorageConfig {},
555601 }
@@ -691,7 +737,8 @@ func (s *RemoteConfigSuite) buildValidSampleConfig() *SampleConfig {
691737 SQSClient : sqsClient ,
692738 DynamoDBTable : dynamodbTable ,
693739 DynamoDBClient : dynamodbClient ,
694- Str : & str ,
740+ Str : str ,
741+ StrPointer : & str ,
695742 StorageConfig : storageConfig ,
696743 StorageConfigSlice : []* StorageConfig {storageConfig },
697744 StorageConfigMap : map [string ]* StorageConfig {"one" : storageConfig },
0 commit comments