Skip to content

Commit

Permalink
Add changelog entry for AWS Lambda.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcgilchrist committed Apr 11, 2022
1 parent bb70eee commit 0925527
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 46 deletions.
13 changes: 6 additions & 7 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
Unreleased
1.2.1
----------

- Add KMS support (#118 @zbaylin)
- Drop dependency on ocaml-migrate-parsetree and use ocaml-compiler-libs (#126 @Nymphium)

1.2.1
----------
- Increase lower bound on OCaml to 4.08. https://github.com/inhabitedtype/ocaml-aws/pull/104
- Migrate CI to github actions https://github.com/inhabitedtype/ocaml-aws/pull/104
- Add STS `assume_role` token support https://github.com/inhabitedtype/ocaml-aws/pull/117
- Increase lower bound on OCaml to 4.08. (#104 @tmcgilchrist)
- Migrate CI to github actions (#104 @tmcgilchrist)
- Add STS `assume_role` token support (#117 @zbaylin @UnrealAkama @bleepbloopsify)
- Initial AWS Lambda support (#108 @tmcgilchrist)

1.2: (24-01-2020)
----------
Expand Down
62 changes: 41 additions & 21 deletions libraries/lambda/lib_test/aws_lambda_test.ml
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
open OUnit
open OUnit2
open Aws_lambda

type config =
{ access_key : string
; secret_key : string
; region : string
}

let ( @? ) = assert_bool

module type Runtime = sig
type 'a m

val run_request :
(module Aws.Call
with type input = 'input
and type output = 'output
and type error = 'error)
region:string
-> access_key:string
-> secret_key:string
-> ?token:string
-> (module Aws.Call
with type input = 'input
and type output = 'output
and type error = 'error)
-> 'input
-> [ `Ok of 'output | `Error of 'error Aws.Error.t ] m

Expand All @@ -17,23 +29,31 @@ end

module TestSuite =
functor
(Runtime : Runtime)
(Runtime : Runtime)
->
struct
let test_cases = []
let noop_test config _ =
"Noop lambda test succeeds"
@?false

let rec was_successful = function
| [] -> true
| RSuccess _ :: t | RSkip _ :: t -> was_successful t
| RFailure _ :: _ | RError _ :: _ | RTodo _ :: _ -> false
let suite config =
"Test Lambda" >::: [ "Lambda noop" >:: noop_test config ]

let _ =
let suite = "Tests" >::: test_cases in
let verbose = ref false in
let set_verbose _ = verbose := true in
Arg.parse
[ "-verbose", Arg.Unit set_verbose, "Run the test in verbose mode." ]
(fun x -> raise (Arg.Bad ("Bad argument : " ^ x)))
("Usage: " ^ Sys.argv.(0) ^ " [-verbose]");
if not (was_successful (run_test_tt ~verbose:!verbose suite)) then exit 1
end
let () =
let access_key =
try Some (Unix.getenv "AWS_ACCESS_KEY_ID") with Not_found -> None
in
let secret_key =
try Some (Unix.getenv "AWS_SECRET_ACCESS_KEY") with Not_found -> None
in
let region = try Some (Unix.getenv "AWS_DEFAULT_REGION") with Not_found -> None in

match access_key, secret_key, region with
| Some access_key, Some secret_key, Some region ->
run_test_tt_main (suite { access_key; secret_key; region })
| _, _, _ ->
Printf.eprintf
"Skipping running tests. Environment variables AWS_ACCESS_KEY_ID, \
AWS_SECRET_ACCESS_KEY and AWS_DEFAULT_REGION not available. ";
exit 0
end
13 changes: 4 additions & 9 deletions libraries/lambda/lib_test/test_async.ml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
open Aws_lambda_test

module T = TestSuite(struct
type 'a m = 'a Async.Deferred.t

let access_key = Unix.getenv "AWS_ACCESS_KEY"
let secret_key = Unix.getenv "AWS_SECRET_KEY"
let region = Unix.getenv "AWS_DEFAULT_REGION"

let run_request x = Aws_async.Runtime.run_request ~region ~access_key ~secret_key x
let un_m v = Async.Thread_safe.block_on_async_exn (fun () -> v)
end)
type 'a m = 'a Async.Deferred.t
let run_request = Aws_async.Runtime.run_request
let un_m v = Async.Thread_safe.block_on_async_exn (fun () -> v)
end)
13 changes: 4 additions & 9 deletions libraries/lambda/lib_test/test_lwt.ml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
open Aws_lambda_test

module T = TestSuite(struct
type 'a m = 'a Lwt.t

let access_key = Unix.getenv "AWS_ACCESS_KEY"
let secret_key = Unix.getenv "AWS_SECRET_KEY"
let region = Unix.getenv "AWS_DEFAULT_REGION"

let run_request x = Aws_lwt.Runtime.run_request ~region ~access_key ~secret_key x
let un_m = Lwt_main.run
end)
type 'a m = 'a Lwt.t
let run_request = Aws_lwt.Runtime.run_request
let un_m = Lwt_main.run
end)

0 comments on commit 0925527

Please sign in to comment.