44import com .github .dockerjava .api .exception .DockerException ;
55import org .junit .Test ;
66
7+ import java .util .Collections ;
8+
79import static org .hamcrest .MatcherAssert .assertThat ;
810import static org .hamcrest .Matchers .containsString ;
911import static org .hamcrest .Matchers .equalTo ;
@@ -16,10 +18,11 @@ public void createVolume() throws DockerException {
1618 String volumeName = "volume1" ;
1719
1820 CreateVolumeResponse createVolumeResponse = dockerRule .getClient ().createVolumeCmd ().withName (volumeName )
19- .withDriver ("local" ).exec ();
21+ .withDriver ("local" ).withLabels ( Collections . singletonMap ( "is-timelord" , "yes" )). exec ();
2022
2123 assertThat (createVolumeResponse .getName (), equalTo (volumeName ));
2224 assertThat (createVolumeResponse .getDriver (), equalTo ("local" ));
25+ assertThat (createVolumeResponse .getLabels (), equalTo (Collections .singletonMap ("is-timelord" , "yes" )));
2326 assertThat (createVolumeResponse .getMountpoint (), containsString ("/volume1/" ));
2427 }
2528
@@ -29,17 +32,19 @@ public void createVolumeWithExistingName() throws DockerException {
2932 String volumeName = "volume1" ;
3033
3134 CreateVolumeResponse createVolumeResponse1 = dockerRule .getClient ().createVolumeCmd ().withName (volumeName )
32- .withDriver ("local" ).exec ();
35+ .withDriver ("local" ).withLabels ( Collections . singletonMap ( "is-timelord" , "yes" )). exec ();
3336
3437 assertThat (createVolumeResponse1 .getName (), equalTo (volumeName ));
3538 assertThat (createVolumeResponse1 .getDriver (), equalTo ("local" ));
39+ assertThat (createVolumeResponse1 .getLabels (), equalTo (Collections .singletonMap ("is-timelord" , "yes" )));
3640 assertThat (createVolumeResponse1 .getMountpoint (), containsString ("/volume1/" ));
3741
3842 CreateVolumeResponse createVolumeResponse2 = dockerRule .getClient ().createVolumeCmd ().withName (volumeName )
39- .withDriver ("local" ).exec ();
43+ .withDriver ("local" ).withLabels ( Collections . singletonMap ( "is-timelord" , "yes" )). exec ();
4044
4145 assertThat (createVolumeResponse2 .getName (), equalTo (volumeName ));
4246 assertThat (createVolumeResponse2 .getDriver (), equalTo ("local" ));
47+ assertThat (createVolumeResponse2 .getLabels (), equalTo (Collections .singletonMap ("is-timelord" , "yes" )));
4348 assertThat (createVolumeResponse2 .getMountpoint (), equalTo (createVolumeResponse1 .getMountpoint ()));
4449 }
4550}
0 commit comments