20
20
import java .io .InputStream ;
21
21
import java .nio .charset .StandardCharsets ;
22
22
import java .util .concurrent .TimeUnit ;
23
- import org .junit .After ;
23
+ import org .junit .AfterClass ;
24
24
import org .junit .Assert ;
25
- import org .junit .Before ;
26
25
import org .junit .BeforeClass ;
27
26
import org .junit .Ignore ;
28
27
import org .junit .Rule ;
46
45
import software .amazon .awssdk .services .lambda .model .ListFunctionsResponse ;
47
46
import software .amazon .awssdk .services .lambda .model .LogType ;
48
47
import software .amazon .awssdk .services .lambda .model .Runtime ;
48
+ import software .amazon .awssdk .services .lambda .waiters .LambdaAsyncWaiter ;
49
49
import software .amazon .awssdk .testutils .retry .RetryRule ;
50
50
import software .amazon .awssdk .utils .BinaryUtils ;
51
51
@@ -58,12 +58,12 @@ public class ServiceIntegrationTest extends IntegrationTestBase {
58
58
public RetryRule retryRule = new RetryRule (10 , 2000 , TimeUnit .MILLISECONDS );
59
59
60
60
@ BeforeClass
61
- public static void setUpKinesis () {
61
+ public static void setUpKinesis () throws IOException {
62
62
IntegrationTestBase .createKinesisStream ();
63
+ uploadFunction ();
63
64
}
64
65
65
- @ Before
66
- public void uploadFunction () throws IOException {
66
+ public static void uploadFunction () throws IOException {
67
67
// Upload function
68
68
SdkBytes functionBits ;
69
69
InputStream functionZip = new FileInputStream (cloudFuncZip );
@@ -81,11 +81,13 @@ public void uploadFunction() throws IOException {
81
81
.timeout (10 )
82
82
.role (lambdaServiceRoleArn )).join ();
83
83
84
+ lambda .waiter ()
85
+ .waitUntilFunctionActive (r -> r .functionName (FUNCTION_NAME ));
84
86
checkValid_CreateFunctionResponse (result );
85
87
}
86
88
87
- @ After
88
- public void deleteFunction () {
89
+ @ AfterClass
90
+ public static void deleteFunction () {
89
91
lambda .deleteFunction (DeleteFunctionRequest .builder ().functionName (FUNCTION_NAME ).build ());
90
92
}
91
93
0 commit comments