11
11
import io .temporal .common .WorkflowExecutionHistory ;
12
12
import io .temporal .spring .boot .autoconfigure .workerversioning .TestWorkflow ;
13
13
import io .temporal .spring .boot .autoconfigure .workerversioning .TestWorkflow2 ;
14
- import org .junit .jupiter .api .Assumptions ;
15
- import org .junit .jupiter .api .BeforeAll ;
16
- import org .junit .jupiter .api .Test ;
17
- import org .junit .jupiter .api .TestInstance ;
18
- import org .junit .jupiter .api .Timeout ;
19
- import org .slf4j .Logger ;
20
- import org .slf4j .LoggerFactory ;
14
+ import org .junit .jupiter .api .*;
21
15
import org .springframework .beans .factory .annotation .Autowired ;
22
16
import org .springframework .boot .test .context .SpringBootTest ;
23
17
import org .springframework .context .ConfigurableApplicationContext ;
26
20
import org .springframework .test .context .ActiveProfiles ;
27
21
28
22
@ SpringBootTest (classes = WorkerVersioningTest .Configuration .class )
29
- @ ActiveProfiles (profiles = "worker-versioning" )
23
+ @ ActiveProfiles (profiles = { "worker-versioning" , "disable-start-workers" } )
30
24
@ TestInstance (TestInstance .Lifecycle .PER_CLASS )
31
25
public class WorkerVersioningTest {
32
26
@ Autowired ConfigurableApplicationContext applicationContext ;
33
27
@ Autowired WorkflowClient workflowClient ;
34
28
35
- private static final Logger log = LoggerFactory .getLogger ("worker-versioning" );
36
-
37
29
@ BeforeAll
38
- void checkDockerServiceAndNamespace () {
30
+ static void checkDockerService () {
39
31
String useDocker = System .getenv ("USE_DOCKER_SERVICE" );
40
- log .info ("USE_DOCKER_SERVICE123: " + useDocker );
41
- if (useDocker != null ) {
42
- log .info ("useDocker.equalsIgnoreCase(true): " + useDocker .equalsIgnoreCase ("true" ));
43
- }
44
- log .info (
45
- "(useDocker != null && useDocker.equalsIgnoreCase())"
46
- + (useDocker != null && useDocker .equalsIgnoreCase ("true" )));
47
32
Assumptions .assumeTrue (
48
- ( useDocker != null && useDocker .equalsIgnoreCase ("true" ) ),
33
+ useDocker != null && useDocker .equalsIgnoreCase ("true" ),
49
34
"Skipping tests because USE_DOCKER_SERVICE is not set" );
50
35
}
51
36
52
- // @BeforeEach
53
- // void setUp() {
54
- // applicationContext.start();
55
- // }
37
+ @ BeforeEach
38
+ void setUp () {
39
+ applicationContext .start ();
40
+ }
56
41
57
42
@ SuppressWarnings ("deprecation" )
58
43
@ Test
59
44
@ Timeout (value = 10 )
60
45
public void testAutoDiscovery () {
61
- applicationContext .start ();
62
- log .info ("testAutoDiscovery started" );
63
46
workflowClient
64
47
.getWorkflowServiceStubs ()
65
48
.blockingStub ()
@@ -69,12 +52,10 @@ public void testAutoDiscovery() {
69
52
.setDeploymentName ("dname" )
70
53
.setVersion ("dname.bid" )
71
54
.build ());
72
- // log.info("testAutoDiscovery 1");
73
55
74
56
TestWorkflow testWorkflow =
75
57
workflowClient .newWorkflowStub (
76
58
TestWorkflow .class , WorkflowOptions .newBuilder ().setTaskQueue ("UnitTest" ).build ());
77
- // log.info("testAutoDiscovery 2");
78
59
WorkflowExecution we1 = WorkflowClient .start (testWorkflow ::execute , "hi" );
79
60
workflowClient .newUntypedWorkflowStub (we1 .getWorkflowId ()).getResult (String .class );
80
61
// Should've used pinned (via default)
@@ -101,7 +82,6 @@ public void testAutoDiscovery() {
101
82
e .getEventType () == EventType .EVENT_TYPE_WORKFLOW_TASK_COMPLETED
102
83
&& e .getWorkflowTaskCompletedEventAttributes ().getVersioningBehavior ()
103
84
== VersioningBehavior .VERSIONING_BEHAVIOR_AUTO_UPGRADE ));
104
- log .info ("testAutoDiscovery done" );
105
85
}
106
86
107
87
@ ComponentScan (
0 commit comments