@@ -50,7 +50,8 @@ type SampleConfig struct {
50
50
SQSClient * SQSClientConfig `json:"sqs_client,omitempty"`
51
51
DynamoDBTable * DynamoDBTableConfig `json:"dynamodb_table,omitempty"`
52
52
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"`
54
55
StorageConfig * StorageConfig `json:"storage_config,omitempty"`
55
56
StorageConfigSlice []* StorageConfig `json:"storage_config_slice,omitempty"`
56
57
StorageConfigMap map [string ]* StorageConfig `json:"storage_config_map,omitempty"`
@@ -79,6 +80,7 @@ var validConfigJSON = `
79
80
"table_name" : "testTable"
80
81
},
81
82
"str" : "testStr",
83
+ "str_pointer" : "testStr",
82
84
"storage_config" : {
83
85
"provider" : "aws",
84
86
"location" : "us-west-2"
@@ -151,7 +153,8 @@ func (s *RemoteConfigSuite) TestValidateConfigWithReflectionWithOptional() {
151
153
SQSClient : sqsClient ,
152
154
DynamoDBTable : dynamodbTable ,
153
155
DynamoDBClient : dynamodbClient ,
154
- Str : & str ,
156
+ Str : str ,
157
+ StrPointer : & str ,
155
158
StorageConfig : storageConfig ,
156
159
StorageConfigSlice : []* StorageConfig {storageConfig },
157
160
StorageConfigMap : map [string ]* StorageConfig {"one" : storageConfig },
@@ -348,12 +351,52 @@ func (s *RemoteConfigSuite) TestValidateConfigWithReflectionErrorStrNotSet() {
348
351
SQSClient : sqsClient ,
349
352
DynamoDBTable : dynamodbTable ,
350
353
DynamoDBClient : dynamodbClient ,
351
- Str : nil ,
354
+ Str : "testString" ,
355
+ StrPointer : nil ,
352
356
}
353
357
354
358
err := validateConfigWithReflection (c )
355
359
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 )
357
400
}
358
401
359
402
func (s * RemoteConfigSuite ) TestValidateConfigWithReflectionErrorStrEmpty () {
@@ -386,7 +429,7 @@ func (s *RemoteConfigSuite) TestValidateConfigWithReflectionErrorStrEmpty() {
386
429
SQSClient : sqsClient ,
387
430
DynamoDBTable : dynamodbTable ,
388
431
DynamoDBClient : dynamodbClient ,
389
- Str : & str ,
432
+ Str : str ,
390
433
}
391
434
392
435
err := validateConfigWithReflection (c )
@@ -424,7 +467,8 @@ func (s *RemoteConfigSuite) TestValidateConfigWithReflectionErrorStorageConfigNo
424
467
SQSClient : sqsClient ,
425
468
DynamoDBTable : dynamodbTable ,
426
469
DynamoDBClient : dynamodbClient ,
427
- Str : & str ,
470
+ Str : str ,
471
+ StrPointer : & str ,
428
472
StorageConfig : nil ,
429
473
}
430
474
@@ -470,7 +514,8 @@ func (s *RemoteConfigSuite) TestValidateConfigWithReflectionErrorStorageConfigSl
470
514
SQSClient : sqsClient ,
471
515
DynamoDBTable : dynamodbTable ,
472
516
DynamoDBClient : dynamodbClient ,
473
- Str : & str ,
517
+ Str : str ,
518
+ StrPointer : & str ,
474
519
StorageConfig : storageConfig ,
475
520
StorageConfigSlice : nil ,
476
521
}
@@ -549,7 +594,8 @@ func (s *RemoteConfigSuite) TestValidateConfigWithReflectionErrorStorageConfigSl
549
594
SQSClient : sqsClient ,
550
595
DynamoDBTable : dynamodbTable ,
551
596
DynamoDBClient : dynamodbClient ,
552
- Str : & str ,
597
+ Str : str ,
598
+ StrPointer : & str ,
553
599
StorageConfig : storageConfig ,
554
600
StorageConfigSlice : []* StorageConfig {},
555
601
}
@@ -691,7 +737,8 @@ func (s *RemoteConfigSuite) buildValidSampleConfig() *SampleConfig {
691
737
SQSClient : sqsClient ,
692
738
DynamoDBTable : dynamodbTable ,
693
739
DynamoDBClient : dynamodbClient ,
694
- Str : & str ,
740
+ Str : str ,
741
+ StrPointer : & str ,
695
742
StorageConfig : storageConfig ,
696
743
StorageConfigSlice : []* StorageConfig {storageConfig },
697
744
StorageConfigMap : map [string ]* StorageConfig {"one" : storageConfig },
0 commit comments