File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,26 @@ defmodule Cadet.Logger.CloudWatchLoggerTest do
2121 metadata: [ :request_id ]
2222 )
2323
24+ # Mock the DescribeLogStreams request during initialization
25+ expect ( ExAwsMock , :request , fn % ExAws.Operation.JSON { } = op
26+ when op . headers == [
27+ { "x-amz-target" , "Logs_20140328.DescribeLogStreams" } ,
28+ { "content-type" , "application/x-amz-json-1.1" }
29+ ] ->
30+ # Simulate no existing log streams
31+ { :ok , % { "logStreams" => [ ] } }
32+ end )
33+
34+ # Mock the CreateLogStream request during initialization
35+ expect ( ExAwsMock , :request , fn % ExAws.Operation.JSON { } = op
36+ when op . headers == [
37+ { "x-amz-target" , "Logs_20140328.CreateLogStream" } ,
38+ { "content-type" , "application/x-amz-json-1.1" }
39+ ] ->
40+ # Simulate successful log stream creation
41+ { :ok , % { } }
42+ end )
43+
2444 LoggerBackends . add ( { CloudWatchLogger , :cloudwatch_logger } )
2545
2646 Logger . configure_backend ( :console , level: :error , format: "$metadata[$level] $message\n " )
You can’t perform that action at this time.
0 commit comments