File: test.pl

package info (click to toggle)
lxctl 0.3.1%2Bdebian-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 404 kB
  • ctags: 199
  • sloc: perl: 2,656; makefile: 35
file content (31 lines) | stat: -rwxr-xr-x 1,020 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/perl

use strict;
use warnings;
use Lxc;
use Test::More tests => 10;
use Test::Trap;

our @list;

# Checking container
#checking path
ok(defined(Lxc::get_config_path()), "LXC_CONF_DIR is defined");
Lxc::set_config_path("/var/lib/");
ok(Lxc::get_config_path() eq "/var/lib/", "LXC_CONF_DIR can be changed");

Lxc::set_config_path("/var/lib/lxc");

@list = Lxc::ls();

ok(Lxc::status() eq "", "Testing Lxc::control::state without vmname");
my @r = trap { Lxc::Kill("abrakadabra", "SIGKILL") };
is ($trap->exit, undef, 'Expecting exit with undef');
is ($trap->stdout, '', "No STDOUT" );
is ($trap->stderr, '', "No STDERR");
print "------------------\n";

ok(Lxc::start("abrakadabra") == 1, "Lxc::start shouldn't start non-existing container");
ok(Lxc::stop("abrakadabra") == 1, "Lxc::stop can stop non-existing machine: just should do nothing");
ok(Lxc::freeze("abrakadabra") == 1, "Lxc::freeze should fail to freeze machine");
ok(Lxc::unfreeze("abrakadabra") == 1, "Lxc::freeze should fail to freeze machine");