Skip to content

Commit 13ceba5

Browse files
authored
Merge pull request #225 from SumoLogic/test_automation_2_11_0
Merging Test automation changes 2.11.0
2 parents e3a77ca + 140975a commit 13ceba5

File tree

40 files changed

+6669
-0
lines changed

40 files changed

+6669
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM python:3.12-alpine
2+
3+
# Install git using apk
4+
RUN apk update && apk add git ruby ruby-dev build-base
5+
RUN gem --version
6+
RUN gem install cfn-nag -v 0.8.10
7+
8+
# Create a working directory
9+
WORKDIR /cf_test_automation
10+
11+
# Copy only image files (like .jpg, .png) from the host to the container
12+
13+
# Copy the specified directories into the container
14+
COPY setup-infra/ /cf_test_automation/test/setup-infra/
15+
COPY testbundles/ /cf_test_automation/test/testbundles/
16+
COPY testcases/ /cf_test_automation/test/testcases/
17+
COPY testsuites/ /cf_test_automation/test/testsuites/
18+
19+
# Optional: Install dependencies
20+
COPY requirements.txt /cf_test_automation/test/
21+
RUN pip install --no-cache-dir -r /cf_test_automation/test/requirements.txt
22+
23+
# Install dependencies (if any, e.g., pip requirements)
24+
# RUN pip install --no-cache-dir -r requirements.txt
25+
RUN pip install --no-cache-dir git+https://<username>:<password>@github.com/SumoLogic/sumologic-aws-cloudformation-test.git@cf_test_automation
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# sumologic-cfn-tester
2+
requests==2.32.3
3+
cfn-lint==0.86.0
4+
jsonschema>=3.2.0
5+
cfn-flip==1.3.0
6+
tabulate>=0.8.6
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
AWSTemplateFormatVersion: '2010-09-09'
2+
Description: CloudFormation template to create an S3 bucket with a random prefix.
3+
4+
Resources:
5+
S3Bucket:
6+
Type: AWS::S3::Bucket
7+
Properties:
8+
BucketName: "test-automation-awso-<RandomString>"
9+
10+
Outputs:
11+
BucketName:
12+
Description: Name of the S3 bucket created.
13+
Value: !Ref S3Bucket
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
AWSTemplateFormatVersion: '2010-09-09'
2+
Description: CloudFormation template to create an sumologic cloudtrail 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+
CloudTrailLogsBucketName:
35+
Type: String
36+
Description: "Required when Bucket creation Flag = No. Provide an Existing bucket name that has CloudTrail 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+
SumoLogicCloudTrailS3Policy:
70+
Type: AWS::IAM::Policy
71+
Properties:
72+
PolicyName: SumoLogicAwsSourcesPoliciesS3CloudTrail
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 CloudTrailLogsBucketName
88+
- !Sub
89+
- "arn:aws:s3:::${S3Bucket}/*"
90+
- S3Bucket: !Ref CloudTrailLogsBucketName
91+
92+
CloudTrailSource:
93+
Type: Custom::AWSSource
94+
DependsOn: SumoLogicCloudTrailS3Policy
95+
Properties:
96+
SourceType: AwsCloudTrailBucket
97+
ServiceToken: !Ref SumoLambdaHelperArn
98+
Region: !Ref "AWS::Region"
99+
SourceName: "test-automation-awso-<TestcaseName>"
100+
TargetBucketName: !Ref CloudTrailLogsBucketName
101+
RemoveOnDeleteStack: true
102+
SourceCategory: "test/automation/awso/cloudtrail/logs"
103+
CollectorId: !Ref SumoCollectorID
104+
SumoAccessID: !Ref SumoLogicAccessID
105+
SumoAccessKey: !Ref SumoLogicAccessKey
106+
SumoDeployment: !Ref SumoLogicDeployment
107+
PathExpression: "*"
108+
Fields:
109+
account: !Ref AccountAlias
110+
RoleArn: !Ref SumoLogicSourceRoleArn
111+
112+
Outputs:
113+
SumoCloudTrailAPIURL:
114+
Description: End point url of cloudtrail log source.
115+
#https://api.sumologic.com/api/v1/collectors/261725249/sources/1511494842
116+
Value: !Sub
117+
- "${BaseUrl}v1/collectors/${CollectorID}/sources/${SourceID}"
118+
- BaseUrl: !FindInMap [SumoLogicEndpoints, !Ref SumoLogicDeployment, apiendpoint]
119+
CollectorID: !Ref SumoCollectorID
120+
SourceID: !Select
121+
- 1
122+
- !Split
123+
- "/"
124+
- !Ref CloudTrailSource
125+
126+
127+
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: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
AWSTemplateFormatVersion: '2010-09-09'
2+
Description: CloudFormation template to create an sumologic 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+
AccountAlias:
30+
Type: String
31+
Description: "Provide an Alias for AWS account for identification in Sumo Logic Explorer View, metrics and logs. Please do not include special characters."
32+
AllowedPattern: "[a-z0-9]*"
33+
ConstraintDescription: "Alias must only contain lowercase letters, number and length less than or equal to 30 characters."
34+
MaxLength: 30
35+
36+
Mappings:
37+
SumoLogicEndpoints:
38+
au:
39+
apiendpoint: "https://api.au.sumologic.com/api/"
40+
ca:
41+
apiendpoint: "https://api.ca.sumologic.com/api/"
42+
de:
43+
apiendpoint: "https://api.de.sumologic.com/api/"
44+
eu:
45+
apiendpoint: "https://api.eu.sumologic.com/api/"
46+
fed:
47+
apiendpoint: "https://api.fed.sumologic.com/api/"
48+
in:
49+
apiendpoint: "https://api.in.sumologic.com/api/"
50+
jp:
51+
apiendpoint: "https://api.jp.sumologic.com/api/"
52+
kr:
53+
apiendpoint: "https://api.kr.sumologic.com/api/"
54+
us1:
55+
apiendpoint: "https://api.sumologic.com/api/"
56+
us2:
57+
apiendpoint: "https://api.us2.sumologic.com/api/"
58+
59+
Resources:
60+
CloudWatchHTTPSource:
61+
Type: Custom::HTTPSource
62+
Properties:
63+
ServiceToken: !Ref SumoLambdaHelperArn
64+
Region: !Ref "AWS::Region"
65+
SourceName: "test-automation-awso-<TestcaseName>"
66+
RemoveOnDeleteStack: true
67+
SourceCategory: "test/automation/awso/cloudwatch/logs"
68+
CollectorId: !Ref SumoCollectorID
69+
SumoAccessID: !Ref SumoLogicAccessID
70+
SumoAccessKey: !Ref SumoLogicAccessKey
71+
SumoDeployment: !Ref SumoLogicDeployment
72+
Fields:
73+
account: !Ref AccountAlias
74+
region: !Ref "AWS::Region"
75+
accountid: !Ref "AWS::AccountId"
76+
77+
78+
Outputs:
79+
SumoCloudWatchLogAPIURL:
80+
Description: End point url of CloudWatch log source.
81+
#https://api.sumologic.com/api/v1/collectors/261725249/sources/1511494842
82+
Value: !Sub
83+
- "${BaseUrl}v1/collectors/${CollectorID}/sources/${SourceID}"
84+
- BaseUrl: !FindInMap [SumoLogicEndpoints, !Ref SumoLogicDeployment, apiendpoint]
85+
CollectorID: !Ref SumoCollectorID
86+
SourceID: !Select
87+
- 1
88+
- !Split
89+
- "/"
90+
- !Ref CloudWatchHTTPSource

0 commit comments

Comments
 (0)