-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlambda_update_function_test.go
34 lines (26 loc) · 1 KB
/
lambda_update_function_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package kanarya
import (
"os"
"testing"
)
// TestUpdateFunctionCode updates the function code of a lambda located on
// $LATEST, and tests the output.
func TestUpdateFunctionCode(t *testing.T) {
lambdaClient := LambdaClient(os.Getenv("AWS_REGION"))
resp, err := UpdateFunctionCode(lambdaClient, testLambdaPackage)
if err != nil {
t.Fatalf("UpdateFunctionCode failed while updating the lambda function. Err %v", err)
}
functionArn := resp.FunctionArn
functionName := resp.FunctionName
lastUpdateStatus := resp.LastUpdateStatus
if functionArn != "arn:aws:lambda:us-east-1:000000000000:function:test-lambda" {
t.Fatalf("UpdateFunctionCode should return a proper function ARN but it returned %v", functionArn)
}
if functionName != "test-lambda" {
t.Fatalf("UpdateFunctionCode should return test-lambda as function name but it returned %v", functionName)
}
if lastUpdateStatus != "Successful" {
t.Fatalf("UpdateFunctionCode should return Successful as status but it returned %v", lastUpdateStatus)
}
}