File tree Expand file tree Collapse file tree 4 files changed +40
-25
lines changed Expand file tree Collapse file tree 4 files changed +40
-25
lines changed Original file line number Diff line number Diff line change 43
43
run : |
44
44
CLUSTER=$(echo 'flightdeck-${{ github.ref_name }}' | cut -c1-20)
45
45
CLUSTER="$CLUSTER-sandbox-v1"
46
+ echo "CLUSTER=$CLUSTER" >> "$GITHUB_ENV"
46
47
aws \
47
48
--region us-east-1 \
48
49
eks \
64
65
65
66
- name : Run tests
66
67
run : |
67
- make tests ADDRESS=https://${{ github.ref_name }}.flightdeck-test.thoughtbot.com
68
+ make tests \
69
+ ADDRESS=https://${{ github.ref_name }}.flightdeck-test.thoughtbot.com \
70
+ CLUSTER="$CLUSTER"
Original file line number Diff line number Diff line change @@ -370,6 +370,7 @@ locals {
370
370
[OUTPUT]
371
371
Name cloudwatch_logs
372
372
Match *
373
+ auto_create_group true
373
374
region ${ data . aws_region . current . name }
374
375
log_group_name ${ module . cloudwatch_logs . log_group_name }
375
376
log_group_template ${ var . logs_prefix } /$kubernetes['namespace_name']
Original file line number Diff line number Diff line change @@ -27,36 +27,17 @@ resource "aws_iam_role_policy_attachment" "this" {
27
27
28
28
data "aws_iam_policy_document" "this" {
29
29
statement {
30
- sid = " AllowCreateLogEvents "
30
+ sid = " AllowWriteLogs "
31
31
actions = [
32
- " logs:DescribeLogStreams" ,
33
- " logs:PutLogEvents"
34
- ]
35
- resources = [
36
- " ${ aws_cloudwatch_log_group . this . arn } :log-stream:*"
37
- ]
38
- }
39
-
40
- statement {
41
- sid = " AllowCreateLogGroup"
42
- actions = [
43
- " logs:CreateLogGroup"
32
+ " logs:CreateLogGroup" ,
33
+ " logs:CreateLogStream" ,
34
+ " logs:PutLogEvents" ,
35
+ " logs:PutRetentionPolicy" ,
44
36
]
45
37
resources = [
46
38
" ${ local . arn_prefix } :log-group:${ var . log_group_prefix } /*"
47
39
]
48
40
}
49
-
50
- statement {
51
- sid = " AllowCreateLogStream"
52
- actions = [
53
- " logs:CreateLogStream"
54
- ]
55
- resources = [
56
- aws_cloudwatch_log_group . this . arn ,
57
- " ${ aws_cloudwatch_log_group . this . arn } :log-stream:*"
58
- ]
59
- }
60
41
}
61
42
62
43
data "aws_caller_identity" "current" {}
Original file line number Diff line number Diff line change 29
29
false
30
30
fi
31
31
}
32
+
33
+ @test " creates log streams within groups for Kubernetes namespaces" {
34
+ expected=" $RANDOM "
35
+ curl -v " $ADDRESS /echo?log=$expected "
36
+ pod=$( kubectl \
37
+ get pod \
38
+ --field-selector=status.phase=Running \
39
+ --selector=app=echoserver \
40
+ -n acceptance \
41
+ --output=name \
42
+ | cut -d' /' -f2)
43
+ logs=$( aws \
44
+ --region us-east-1 \
45
+ logs \
46
+ get-log-events \
47
+ --log-group-name " /flightdeck/acceptance" \
48
+ --log-stream-name " $pod .echoserver" \
49
+ --query ' events[*].[message]' \
50
+ --output text)
51
+
52
+ if ! echo " $logs " | grep -q " log=$expected " ; then
53
+ echo " Failed to find log for test request." >&2
54
+ echo >&2
55
+ echo " Test request was: GET /echo?log=$expected " >&2
56
+ echo >&2
57
+ echo " Found log entries" >&2
58
+ echo " $logs " >&2
59
+ false
60
+ fi
61
+ }
You can’t perform that action at this time.
0 commit comments