TisonKun commented on a change in pull request #7720: [FLINK-10569] Refactor 
CoLocationConstraintTest and remove Instance u…
URL: https://github.com/apache/flink/pull/7720#discussion_r259011680
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/jobmanager/scheduler/CoLocationConstraintTest.java
 ##########
 @@ -64,39 +65,25 @@ public void testCreateConstraints() {
        }
 
        @Test
-       public void testAssignSlotAndLockLocation() throws Exception {
-               JobID jid = new JobID();
-
+       public void testLockLocation() {
                JobVertex vertex = new JobVertex("vertex");
                vertex.setParallelism(1);
 
-               SlotSharingGroup sharingGroup = new 
SlotSharingGroup(vertex.getID());
-               SlotSharingGroupAssignment assignment = 
sharingGroup.getTaskAssignment();
-
                CoLocationGroup constraintGroup = new CoLocationGroup(vertex);
                CoLocationConstraint constraint = 
constraintGroup.getLocationConstraint(0);
 
-               // constraint is completely unassigned
-               assertFalse(constraint.isAssigned());
-               assertFalse(constraint.isAssignedAndAlive());
-
-               Instance instance1 = SchedulerTestUtils.getRandomInstance(2);
-               Instance instance2 = SchedulerTestUtils.getRandomInstance(2);
-
-               SharedSlot slot1_1 = instance1.allocateSharedSlot(assignment);
-               SharedSlot slot1_2 = instance1.allocateSharedSlot(assignment);
-               SharedSlot slot2_1 = instance2.allocateSharedSlot(assignment);
-               SharedSlot slot2_2 = instance2.allocateSharedSlot(assignment);
+               assertThat(constraint.getSlotRequestId(), is(nullValue()));
+               assertThat(constraint.isAssigned(), is(false));
 
-               // constraint is still completely unassigned
-               assertFalse(constraint.isAssigned());
-               assertFalse(constraint.isAssignedAndAlive());
+               SlotRequestId slotRequestId1 = new SlotRequestId();
+               constraint.setSlotRequestId(slotRequestId1);
+               assertThat(constraint.getSlotRequestId(), is(slotRequestId1));
 
 Review comment:
   resolved.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to