use of com.spotify.docker.client.messages.VolumeList in project docker-client by spotify.
the class DefaultDockerClientTest method testListVolumes.
@Test
public void testListVolumes() throws Exception {
requireDockerApiVersionAtLeast("1.21", "volumes");
final Volume volume = sut.createVolume();
final String volumeName = volume.name();
final String volumeDriver = volume.driver();
final VolumeList volumeList = sut.listVolumes();
if (volumeList.warnings() != null && volumeList.warnings().isEmpty()) {
for (final String warning : volumeList.warnings()) {
log.warn(warning);
}
}
assertThat(volume, isIn(volumeList.volumes()));
final VolumeList volumeListWithDangling = sut.listVolumes(dangling());
if (volumeListWithDangling.warnings() != null && !volumeListWithDangling.warnings().isEmpty()) {
for (final String warning : volumeListWithDangling.warnings()) {
log.warn(warning);
}
}
assertThat(volume, isIn(volumeListWithDangling.volumes()));
if (dockerApiVersionAtLeast("1.24")) {
final VolumeList volumeListByName = sut.listVolumes(name(volumeName));
if (volumeListByName.warnings() != null && !volumeListByName.warnings().isEmpty()) {
for (final String warning : volumeListByName.warnings()) {
log.warn(warning);
}
}
assertThat(volume, isIn(volumeListByName.volumes()));
final VolumeList volumeListByDriver = sut.listVolumes(driver(volumeDriver));
if (volumeListByDriver.warnings() != null && !volumeListByDriver.warnings().isEmpty()) {
for (final String warning : volumeListByDriver.warnings()) {
log.warn(warning);
}
}
assertThat(volume, isIn(volumeListByDriver.volumes()));
}
if (dockerApiVersionAtLeast("1.24")) {
assertEquals("local", volume.scope());
// I don't know what is in the status object - JF
assertThat(volume.status(), is(anything()));
}
sut.removeVolume(volume);
}
Aggregations