Skip to content

Commit 0925527

Browse files
committed
Add changelog entry for AWS Lambda.
1 parent bb70eee commit 0925527

File tree

4 files changed

+55
-46
lines changed

4 files changed

+55
-46
lines changed

CHANGES.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
Unreleased
1+
1.2.1
22
----------
3+
34
- Add KMS support (#118 @zbaylin)
45
- Drop dependency on ocaml-migrate-parsetree and use ocaml-compiler-libs (#126 @Nymphium)
5-
6-
1.2.1
7-
----------
8-
- Increase lower bound on OCaml to 4.08. https://github.com/inhabitedtype/ocaml-aws/pull/104
9-
- Migrate CI to github actions https://github.com/inhabitedtype/ocaml-aws/pull/104
10-
- Add STS `assume_role` token support https://github.com/inhabitedtype/ocaml-aws/pull/117
6+
- Increase lower bound on OCaml to 4.08. (#104 @tmcgilchrist)
7+
- Migrate CI to github actions (#104 @tmcgilchrist)
8+
- Add STS `assume_role` token support (#117 @zbaylin @UnrealAkama @bleepbloopsify)
9+
- Initial AWS Lambda support (#108 @tmcgilchrist)
1110

1211
1.2: (24-01-2020)
1312
----------
Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
1-
open OUnit
1+
open OUnit2
22
open Aws_lambda
33

4+
type config =
5+
{ access_key : string
6+
; secret_key : string
7+
; region : string
8+
}
9+
10+
let ( @? ) = assert_bool
11+
412
module type Runtime = sig
513
type 'a m
614

715
val run_request :
8-
(module Aws.Call
9-
with type input = 'input
10-
and type output = 'output
11-
and type error = 'error)
16+
region:string
17+
-> access_key:string
18+
-> secret_key:string
19+
-> ?token:string
20+
-> (module Aws.Call
21+
with type input = 'input
22+
and type output = 'output
23+
and type error = 'error)
1224
-> 'input
1325
-> [ `Ok of 'output | `Error of 'error Aws.Error.t ] m
1426

@@ -17,23 +29,31 @@ end
1729

1830
module TestSuite =
1931
functor
20-
(Runtime : Runtime)
32+
(Runtime : Runtime)
2133
->
2234
struct
23-
let test_cases = []
35+
let noop_test config _ =
36+
"Noop lambda test succeeds"
37+
@?false
2438

25-
let rec was_successful = function
26-
| [] -> true
27-
| RSuccess _ :: t | RSkip _ :: t -> was_successful t
28-
| RFailure _ :: _ | RError _ :: _ | RTodo _ :: _ -> false
39+
let suite config =
40+
"Test Lambda" >::: [ "Lambda noop" >:: noop_test config ]
2941

30-
let _ =
31-
let suite = "Tests" >::: test_cases in
32-
let verbose = ref false in
33-
let set_verbose _ = verbose := true in
34-
Arg.parse
35-
[ "-verbose", Arg.Unit set_verbose, "Run the test in verbose mode." ]
36-
(fun x -> raise (Arg.Bad ("Bad argument : " ^ x)))
37-
("Usage: " ^ Sys.argv.(0) ^ " [-verbose]");
38-
if not (was_successful (run_test_tt ~verbose:!verbose suite)) then exit 1
39-
end
42+
let () =
43+
let access_key =
44+
try Some (Unix.getenv "AWS_ACCESS_KEY_ID") with Not_found -> None
45+
in
46+
let secret_key =
47+
try Some (Unix.getenv "AWS_SECRET_ACCESS_KEY") with Not_found -> None
48+
in
49+
let region = try Some (Unix.getenv "AWS_DEFAULT_REGION") with Not_found -> None in
50+
51+
match access_key, secret_key, region with
52+
| Some access_key, Some secret_key, Some region ->
53+
run_test_tt_main (suite { access_key; secret_key; region })
54+
| _, _, _ ->
55+
Printf.eprintf
56+
"Skipping running tests. Environment variables AWS_ACCESS_KEY_ID, \
57+
AWS_SECRET_ACCESS_KEY and AWS_DEFAULT_REGION not available. ";
58+
exit 0
59+
end
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
open Aws_lambda_test
22

33
module T = TestSuite(struct
4-
type 'a m = 'a Async.Deferred.t
5-
6-
let access_key = Unix.getenv "AWS_ACCESS_KEY"
7-
let secret_key = Unix.getenv "AWS_SECRET_KEY"
8-
let region = Unix.getenv "AWS_DEFAULT_REGION"
9-
10-
let run_request x = Aws_async.Runtime.run_request ~region ~access_key ~secret_key x
11-
let un_m v = Async.Thread_safe.block_on_async_exn (fun () -> v)
12-
end)
4+
type 'a m = 'a Async.Deferred.t
5+
let run_request = Aws_async.Runtime.run_request
6+
let un_m v = Async.Thread_safe.block_on_async_exn (fun () -> v)
7+
end)

libraries/lambda/lib_test/test_lwt.ml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
open Aws_lambda_test
22

33
module T = TestSuite(struct
4-
type 'a m = 'a Lwt.t
5-
6-
let access_key = Unix.getenv "AWS_ACCESS_KEY"
7-
let secret_key = Unix.getenv "AWS_SECRET_KEY"
8-
let region = Unix.getenv "AWS_DEFAULT_REGION"
9-
10-
let run_request x = Aws_lwt.Runtime.run_request ~region ~access_key ~secret_key x
11-
let un_m = Lwt_main.run
12-
end)
4+
type 'a m = 'a Lwt.t
5+
let run_request = Aws_lwt.Runtime.run_request
6+
let un_m = Lwt_main.run
7+
end)

0 commit comments

Comments
 (0)