Skip to content

Commit 140975a

Browse files
Merge pull request #223 from SumoLogic/test_automation_1
Test automation 1
2 parents e6146e8 + 0ef69cb commit 140975a

32 files changed

+1461
-223
lines changed
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
AWSTemplateFormatVersion: "2010-09-09"
2+
Description: CloudFormation template to create an sumologic collector and source.
3+
4+
Parameters:
5+
SumoLogicDeployment:
6+
Type: String
7+
Default: ""
8+
Description: "Enter au, ca, de, eu, fed, in, jp, kr, us1 or us2"
9+
SumoLogicAccessID:
10+
Type: String
11+
Description: "Sumo Logic Access ID. Used for Sumo Logic API calls."
12+
AllowedPattern: ".+"
13+
ConstraintDescription: "Sumo Logic Access ID can not be empty."
14+
SumoLogicAccessKey:
15+
Type: String
16+
Description: "Sumo Logic Access Key. Used for Sumo Logic API calls."
17+
AllowedPattern: ".+"
18+
ConstraintDescription: "Sumo Logic Access Key can not be empty."
19+
NoEcho: true
20+
SumoLambdaHelperArn:
21+
Type: String
22+
Default: ""
23+
Description: "Sumo Logic Lambda Helper"
24+
ConstraintDescription: "Sumo Logic Lambda Helper can not be empty."
25+
SumoCollectorID:
26+
Type: String
27+
Default: ""
28+
Description: "Sumo Logic Collector ID can not be empty"
29+
SumoLogicSourceRoleArn:
30+
Type: String
31+
Default: ""
32+
Description: "Sumo Logic Lambda source role"
33+
ConstraintDescription: "Sumo Logic Lambda source role can not be empty."
34+
LBLogsBucketName:
35+
Type: String
36+
Description: "Required when Bucket creation Flag = No. Provide an Existing bucket name that has Load balancer access logs."
37+
Default: ""
38+
AccountAlias:
39+
Type: String
40+
Description: "Provide an Alias for AWS account for identification in Sumo Logic Explorer View, metrics and logs. Please do not include special characters."
41+
AllowedPattern: "[a-z0-9]*"
42+
ConstraintDescription: "Alias must only contain lowercase letters, number and length less than or equal to 30 characters."
43+
MaxLength: 30
44+
45+
Mappings:
46+
SumoLogicEndpoints:
47+
au:
48+
apiendpoint: "https://api.au.sumologic.com/api/"
49+
ca:
50+
apiendpoint: "https://api.ca.sumologic.com/api/"
51+
de:
52+
apiendpoint: "https://api.de.sumologic.com/api/"
53+
eu:
54+
apiendpoint: "https://api.eu.sumologic.com/api/"
55+
fed:
56+
apiendpoint: "https://api.fed.sumologic.com/api/"
57+
in:
58+
apiendpoint: "https://api.in.sumologic.com/api/"
59+
jp:
60+
apiendpoint: "https://api.jp.sumologic.com/api/"
61+
kr:
62+
apiendpoint: "https://api.kr.sumologic.com/api/"
63+
us1:
64+
apiendpoint: "https://api.sumologic.com/api/"
65+
us2:
66+
apiendpoint: "https://api.us2.sumologic.com/api/"
67+
68+
Resources:
69+
SumoLogicLoadBalancerS3Policy:
70+
Type: AWS::IAM::Policy
71+
Properties:
72+
PolicyName: SumoLogicAwsSourcesPoliciesS3LoadBalancer
73+
Roles:
74+
- !Select [1, !Split ["/", !Ref SumoLogicSourceRoleArn]]
75+
PolicyDocument:
76+
Version: "2012-10-17"
77+
Statement:
78+
- Effect: Allow
79+
Action:
80+
- s3:GetObject
81+
- s3:GetObjectVersion
82+
- s3:ListBucketVersions
83+
- s3:ListBucket
84+
Resource:
85+
- !Sub
86+
- "arn:aws:s3:::${S3Bucket}"
87+
- S3Bucket: !Ref LBLogsBucketName
88+
- !Sub
89+
- "arn:aws:s3:::${S3Bucket}/*"
90+
- S3Bucket: !Ref LBLogsBucketName
91+
ALBSource:
92+
Type: Custom::AWSSource
93+
DependsOn: SumoLogicLoadBalancerS3Policy
94+
Properties:
95+
ServiceToken: !Ref SumoLambdaHelperArn
96+
SourceType: AwsElbBucket
97+
Region: !Ref "AWS::Region"
98+
SourceName: "test-automation-awso-<TestcaseName>"
99+
RemoveOnDeleteStack: true
100+
SourceCategory: "test/automation/awso/cloudwatch/metrics"
101+
CollectorId: !Ref SumoCollectorID
102+
SumoAccessID: !Ref SumoLogicAccessID
103+
SumoAccessKey: !Ref SumoLogicAccessKey
104+
SumoDeployment: !Ref SumoLogicDeployment
105+
TargetBucketName: !Ref LBLogsBucketName
106+
PathExpression: "*"
107+
Fields:
108+
account: !Ref AccountAlias
109+
region: !Ref "AWS::Region"
110+
accountid: !Ref "AWS::AccountId"
111+
RoleArn: !Ref SumoLogicSourceRoleArn
112+
113+
Outputs:
114+
SumoLoadBalancerLogAPIURL:
115+
Description: End point url of load balancer access logs source.
116+
#https://api.sumologic.com/api/v1/collectors/261725249/sources/1511494842
117+
Value: !Sub
118+
- "${BaseUrl}v1/collectors/${CollectorID}/sources/${SourceID}"
119+
- BaseUrl:
120+
!FindInMap [SumoLogicEndpoints, !Ref SumoLogicDeployment, apiendpoint]
121+
CollectorID: !Ref SumoCollectorID
122+
SourceID: !Select
123+
- 1
124+
- !Split
125+
- "/"
126+
- !Ref ALBSource
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
AWSTemplateFormatVersion: "2010-09-09"
2+
Description: CloudFormation template to create an sumologic collector and source.
3+
4+
Parameters:
5+
SumoLogicDeployment:
6+
Type: String
7+
Default: ""
8+
Description: "Enter au, ca, de, eu, fed, in, jp, kr, us1 or us2"
9+
SumoLogicAccessID:
10+
Type: String
11+
Description: "Sumo Logic Access ID. Used for Sumo Logic API calls."
12+
AllowedPattern: ".+"
13+
ConstraintDescription: "Sumo Logic Access ID can not be empty."
14+
SumoLogicAccessKey:
15+
Type: String
16+
Description: "Sumo Logic Access Key. Used for Sumo Logic API calls."
17+
AllowedPattern: ".+"
18+
ConstraintDescription: "Sumo Logic Access Key can not be empty."
19+
NoEcho: true
20+
SumoLambdaHelperArn:
21+
Type: String
22+
Default: ""
23+
Description: "Sumo Logic Lambda Helper"
24+
ConstraintDescription: "Sumo Logic Lambda Helper can not be empty."
25+
SumoLogicSourceRoleArn:
26+
Type: String
27+
Default: ""
28+
Description: "Sumo Logic Lambda source role"
29+
ConstraintDescription: "Sumo Logic Lambda source role can not be empty."
30+
SumoCollectorID:
31+
Type: String
32+
Default: ""
33+
Description: "Sumo Logic Collector ID can not be empty"
34+
AccountAlias:
35+
Type: String
36+
Description: "Provide an Alias for AWS account for identification in Sumo Logic Explorer View, metrics and logs. Please do not include special characters."
37+
AllowedPattern: "[a-z0-9]*"
38+
ConstraintDescription: "Alias must only contain lowercase letters, number and length less than or equal to 30 characters."
39+
MaxLength: 30
40+
41+
Mappings:
42+
SumoLogicEndpoints:
43+
au:
44+
apiendpoint: "https://api.au.sumologic.com/api/"
45+
ca:
46+
apiendpoint: "https://api.ca.sumologic.com/api/"
47+
de:
48+
apiendpoint: "https://api.de.sumologic.com/api/"
49+
eu:
50+
apiendpoint: "https://api.eu.sumologic.com/api/"
51+
fed:
52+
apiendpoint: "https://api.fed.sumologic.com/api/"
53+
in:
54+
apiendpoint: "https://api.in.sumologic.com/api/"
55+
jp:
56+
apiendpoint: "https://api.jp.sumologic.com/api/"
57+
kr:
58+
apiendpoint: "https://api.kr.sumologic.com/api/"
59+
us1:
60+
apiendpoint: "https://api.sumologic.com/api/"
61+
us2:
62+
apiendpoint: "https://api.us2.sumologic.com/api/"
63+
64+
Resources:
65+
KinesisFirehoseMetricsSource:
66+
Type: Custom::HTTPSource
67+
Properties:
68+
ServiceToken: !Ref SumoLambdaHelperArn
69+
Region: !Ref "AWS::Region"
70+
SourceType: "KinesisMetric"
71+
SourceName: "test-automation-awso-<TestcaseName>"
72+
RemoveOnDeleteStack: true
73+
SourceCategory: "test/automation/awso/cloudwatch/metrics"
74+
CollectorId: !Ref SumoCollectorID
75+
SumoAccessID: !Ref SumoLogicAccessID
76+
SumoAccessKey: !Ref SumoLogicAccessKey
77+
SumoDeployment: !Ref SumoLogicDeployment
78+
Fields:
79+
account: !Ref AccountAlias
80+
RoleArn: !Ref SumoLogicSourceRoleArn
81+
82+
Outputs:
83+
SumoCloudWatchMetricsAPIURL:
84+
Description: End point url of CloudWatch log source.
85+
#https://api.sumologic.com/api/v1/collectors/261725249/sources/1511494842
86+
Value: !Sub
87+
- "${BaseUrl}v1/collectors/${CollectorID}/sources/${SourceID}"
88+
- BaseUrl:
89+
!FindInMap [SumoLogicEndpoints, !Ref SumoLogicDeployment, apiendpoint]
90+
CollectorID: !Ref SumoCollectorID
91+
SourceID: !Select
92+
- 1
93+
- !Split
94+
- "/"
95+
- !Ref KinesisFirehoseMetricsSource

aws-observability/templates/test/testbundles/all_testsuites_bundle.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
Global:
33
TemplatePath: "https://sumologic-appdev-aws-sam-apps.s3.amazonaws.com/aws-observability-versions/v2.11.0/sumologic_observability.master.template.yaml"
4-
StackName: AWSO-<datetime>
4+
StackName: AWSO
55
ParallelTestsRun: 1
66
GlobalParameters:
77
Default:

aws-observability/templates/test/testbundles/lb_bundle.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
Global:
33
TemplatePath: "https://sumologic-appdev-aws-sam-apps.s3.amazonaws.com/aws-observability-versions/v2.11.0/sumologic_observability.master.template.yaml"
4-
StackName: AWSO-<datetime>
4+
StackName: AWSO
55
ParallelTestsRun: 1
66
GlobalParameters:
77
Default:
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Global:
3-
StackName: AWSO-<datetime>
3+
StackName: AWSO
44
ParallelTestsRun: 1
55
GlobalParameters:
66
Default:
@@ -9,4 +9,4 @@ Global:
99
Section1fSumoLogicSendTelemetry: 'true'
1010
TestBundleName: updateBundle
1111
TestSuites:
12-
- 'test/testsuites/update_testsuite.yaml'
12+
- 'test/testsuites/update_v2_11_testsuite.yaml'

aws-observability/templates/test/testbundles/upgrade_bundle.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
---
22
Global:
3-
StackName: AWSO-<datetime>
3+
StackName: AWSO
44
ParallelTestsRun: 1
55
GlobalParameters:
66
Default:
77
Section1eSumoLogicResourceRemoveOnDeleteStack: 'true'
88
TestBundleName: upgradeUpdateBundle
99
TestSuites:
10-
- 'test/testsuites/upgrade_update_v2.9_to_v2.10_testsuite.yaml'
11-
- 'test/testsuites/update_testsuite.yaml'
12-
- 'test/testsuites/upgrade_v2.7_to_v2.9_testsuite.yaml'
10+
- 'test/testsuites/upgrade_update_v2_10_testsuite.yaml'
11+
- 'test/testsuites/upgrade_update_v2_11_testsuite.yaml'

aws-observability/templates/test/testcases/infra/create_source_existing_bucket_existing_sources.yaml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ TestCase:
4646
Section9aAutoEnableS3LogsELBResourcesOptions: 'None'
4747
Section9bELBCreateLogSource: 'Yes'
4848
Section9cELBLogsSourceUrl: 'https://api.us2.sumologic.com/api/v1/collectors/350831942/sources/2763251087'
49-
Section9dELBS3LogsBucketName: 'akhilblogs-ap-southeast-1'
49+
Section9dELBS3LogsBucketName: 'akhilblogs-<REGION>'
5050
Section9eELBS3BucketPathExpression: '*abc*'
5151
Assertions:
5252
- AssertType: ResourceExistence
@@ -175,6 +175,8 @@ TestCase:
175175
- sumoLambdaMetricsAppStack.AccountAliasValue
176176
- CreateCommonResources.LambdaHelperAlias
177177
- CreateCommonResources.LambdaRoleAlias
178+
- sumoAlbMetricsAppStack.AlbCloudTrailLogsFieldExtractionRule
179+
- sumoElbMetricsAppStack.ClbCloudTrailLogsFieldExtractionRule
178180
- AssertType: OutputsCheck
179181
Assert:
180182
Outputs:
@@ -203,36 +205,36 @@ TestCase:
203205
MetaDataSourceName: ""
204206
MetaDataSourceCategory: ""
205207
CreateCloudWatchMetricsSource: 'Yes'
206-
CloudWatchMetricsSourceName: 'cloudwatch-metrics-ap-southeast-1'
208+
CloudWatchMetricsSourceName: 'cloudwatch-metrics-<REGION>'
207209
CloudWatchMetricsNameSpaces: "AWS/ApiGateway, AWS/DynamoDB, AWS/ElastiCache, AWS/SNS, AWS/SQS"
208210
ScanInterval: "30000"
209211
CloudWatchMetricSourceCategory: "aws/observability/cloudwatch/metrics"
210212
CreateALBLogSource: 'Yes'
211213
CreateALBS3Bucket: 'No'
212214
ALBS3LogsBucketName: ""
213215
ALBS3BucketPathExpression: ''
214-
ALBLogsSourceName: "alb-logs-ap-southeast-1"
216+
ALBLogsSourceName: "alb-logs-<REGION>"
215217
ALBLogsSourceCategory: "aws/observability/alb/logs"
216218
CreateELBLogSource: 'Yes'
217219
CreateELBS3Bucket: 'No'
218220
ELBS3LogsBucketName: ""
219221
ELBS3BucketPathExpression: ''
220-
ELBLogsSourceName: "classic-lb-logs-ap-southeast-1"
222+
ELBLogsSourceName: "classic-lb-logs-<REGION>"
221223
ELBLogsSourceCategory: "aws/observability/clb/logs"
222224
CreateCloudTrailLogSource: 'Yes'
223225
CreateCloudTrailBucket: 'No'
224226
CloudTrailLogsBucketName: ""
225227
CloudTrailBucketPathExpression: ''
226-
CloudTrailLogsSourceName: "cloudtrail-logs-ap-southeast-1"
228+
CloudTrailLogsSourceName: "cloudtrail-logs-<REGION>"
227229
CloudTrailLogsSourceCategory: "aws/observability/cloudtrail/logs"
228230
CreateCloudWatchLogSource: 'Yes'
229-
CloudWatchLogsSourceName: "cloudwatch-logs-ap-southeast-1"
231+
CloudWatchLogsSourceName: "cloudwatch-logs-<REGION>"
230232
CloudWatchLogsSourceCategory: "aws/observability/cloudwatch/logs"
231233
CreateKinesisFirehoseLogSource: 'Yes'
232-
KinesisFirehoseLogsSourceName: 'kinesis-firehose-cloudwatch-logs-ap-southeast-1'
234+
KinesisFirehoseLogsSourceName: 'kinesis-firehose-cloudwatch-logs-<REGION>'
233235
KinesisFirehoseLogsSourceCategory: 'aws/observability/cloudwatch/logs'
234236
CreateKinesisFirehoseMetricsSource: 'No'
235-
KinesisFirehoseMetricsSourceName: 'cloudwatch-metrics-ap-southeast-1'
237+
KinesisFirehoseMetricsSourceName: 'cloudwatch-metrics-<REGION>'
236238
KinesisFirehoseMetricSourceCategory: 'aws/observability/cloudwatch/metrics'
237239
CreateCommonResources.KinesisFirehoseLogsStack:
238240
Section2aCreateS3Bucket: 'Yes'
@@ -281,10 +283,10 @@ TestCase:
281283
Section2aInstallApp: 'No'
282284
Section2bCollectorName: ""
283285
Section3aCreateAwsInventorySource: 'Yes'
284-
Section3bAwsInventorySourceName: "inventory-ap-southeast-1"
286+
Section3bAwsInventorySourceName: "inventory-<REGION>"
285287
Section3dInventorySourceCategory: "aws/observability/inventory"
286288
Section4aCreateAwsXRaySource: 'No'
287-
Section4bAwsXRaySourceName: "xray-ap-southeast-1"
289+
Section4bAwsXRaySourceName: "xray-<REGION>"
288290
Section4cXraySourceCategory: "aws/observability/xray"
289291
sumoLambdaMetricsAppStack:
290292
Section2aAccountAlias: 'infrat7'

0 commit comments

Comments
 (0)