File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed
src/test/java/org/apache/cloudstack/utils/qemu Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change 107107 </execution >
108108 </executions >
109109 </plugin >
110- <plugin >
111- <groupId >org.apache.maven.plugins</groupId >
112- <artifactId >maven-surefire-plugin</artifactId >
113- <configuration >
114- <excludes >
115- <exclude >**/QemuImg*.java</exclude >
116- </excludes >
117- </configuration >
118- </plugin >
119110 </plugins >
120111 </build >
121112 <profiles >
Original file line number Diff line number Diff line change 3434import org .apache .cloudstack .utils .qemu .QemuImg .PhysicalDiskFormat ;
3535import org .apache .commons .collections .MapUtils ;
3636import org .junit .Assert ;
37+ import org .junit .Assume ;
38+ import org .junit .BeforeClass ;
3739import org .junit .Ignore ;
3840import org .junit .Test ;
3941import org .junit .runner .RunWith ;
42+ import org .libvirt .Connect ;
4043import org .libvirt .LibvirtException ;
4144import org .mockito .Mockito ;
4245import org .mockito .junit .MockitoJUnitRunner ;
4649@ RunWith (MockitoJUnitRunner .class )
4750public class QemuImgTest {
4851
52+ @ BeforeClass
53+ public static void setUp () {
54+ Assume .assumeTrue ("qemu-img not found" , Script .runSimpleBashScript ("command -v qemu-img" ) != null );
55+ boolean libVirtAvailable = false ;
56+ try {
57+ Connect conn = new Connect ("qemu:///system" , false );
58+ conn .getVersion ();
59+ libVirtAvailable = true ;
60+ } catch (LibvirtException ignored ) {}
61+ Assume .assumeTrue ("libvirt not available" , libVirtAvailable );
62+ }
63+
4964 @ Test
5065 public void testCreateAndInfo () throws QemuImgException , LibvirtException {
5166 String filename = "/tmp/" + UUID .randomUUID () + ".qcow2" ;
You can’t perform that action at this time.
0 commit comments