31
31
"alpine" ,
32
32
"archlinux" ,
33
33
"centos_7" ,
34
- "debian_buster " ,
34
+ "debian_bullseye " ,
35
35
"ubuntu_xenial" ,
36
36
)
37
37
]
@@ -51,16 +51,16 @@ def test_package(host, docker_image):
51
51
"alpine" : "8." ,
52
52
"archlinux" : "8." ,
53
53
"centos_7" : "7." ,
54
- "debian_buster " : "1:7.9 " ,
54
+ "debian_bullseye " : "1:8.4 " ,
55
55
"ubuntu_xenial" : "1:7.2" ,
56
56
}[docker_image ]
57
57
assert ssh .is_installed
58
58
assert ssh .version .startswith (version )
59
59
release = {
60
- "alpine" : "r0 " ,
60
+ "alpine" : "r2 " ,
61
61
"archlinux" : None ,
62
62
"centos_7" : ".el7" ,
63
- "debian_buster " : None ,
63
+ "debian_bullseye " : None ,
64
64
"ubuntu_xenial" : None ,
65
65
}[docker_image ]
66
66
if release is None :
@@ -71,9 +71,9 @@ def test_package(host, docker_image):
71
71
72
72
73
73
def test_held_package (host ):
74
- python = host .package ("python " )
74
+ python = host .package ("python3 " )
75
75
assert python .is_installed
76
- assert python .version .startswith ("2.7 ." )
76
+ assert python .version .startswith ("3.9 ." )
77
77
78
78
79
79
@pytest .mark .testinfra_hosts ("docker://centos_7" )
@@ -95,7 +95,7 @@ def test_uninstalled_package_version(host):
95
95
host .package ("sudo" ).version
96
96
assert (
97
97
"The package sudo is not installed, dpkg-query output: "
98
- "deinstall ok config-files 1.8 ."
98
+ "deinstall ok config-files 1.9 ."
99
99
) in str (excinfo .value )
100
100
101
101
@@ -104,10 +104,10 @@ def test_systeminfo(host, docker_image):
104
104
assert host .system_info .type == "linux"
105
105
106
106
release , distribution , codename , arch = {
107
- "alpine" : (r"^3\.11 \." , "alpine" , None , "x86_64" ),
107
+ "alpine" : (r"^3\.14 \." , "alpine" , None , "x86_64" ),
108
108
"archlinux" : ("rolling" , "arch" , None , "x86_64" ),
109
109
"centos_7" : (r"^7$" , "centos" , None , "x86_64" ),
110
- "debian_buster " : (r"^10 " , "debian" , "buster " , "x86_64" ),
110
+ "debian_bullseye " : (r"^11 " , "debian" , "bullseye " , "x86_64" ),
111
111
"ubuntu_xenial" : (r"^16\.04$" , "ubuntu" , "xenial" , "x86_64" ),
112
112
}[docker_image ]
113
113
@@ -178,16 +178,16 @@ def test_service(host, name, running, enabled):
178
178
179
179
def test_salt (host ):
180
180
ssh_version = host .salt ("pkg.version" , "openssh-server" , local = True )
181
- assert ssh_version .startswith ("1:7.9 " )
181
+ assert ssh_version .startswith ("1:8.4 " )
182
182
183
183
184
184
def test_puppet_resource (host ):
185
185
resource = host .puppet_resource ("package" , "openssh-server" )
186
- assert resource ["openssh-server" ]["ensure" ].startswith ("1:7.9 " )
186
+ assert resource ["openssh-server" ]["ensure" ].startswith ("1:8.4 " )
187
187
188
188
189
189
def test_facter (host ):
190
- assert host .facter ()["os" ]["distro" ]["codename" ] == "buster "
190
+ assert host .facter ()["os" ]["distro" ]["codename" ] == "bullseye "
191
191
assert host .facter ("virtual" ) in (
192
192
{"virtual" : "docker" },
193
193
{"virtual" : "hyperv" }, # github action uses hyperv
@@ -253,7 +253,7 @@ def test_process(host, docker_image):
253
253
"alpine" : ("/sbin/init" , "init" ),
254
254
"archlinux" : ("/usr/sbin/init" , "systemd" ),
255
255
"centos_7" : ("/usr/sbin/init" , "systemd" ),
256
- "debian_buster " : ("/sbin/init" , "systemd" ),
256
+ "debian_bullseye " : ("/sbin/init" , "systemd" ),
257
257
"ubuntu_xenial" : ("/sbin/init" , "systemd" ),
258
258
}[docker_image ]
259
259
assert init .args == args
@@ -264,7 +264,7 @@ def test_user(host):
264
264
user = host .user ("sshd" )
265
265
assert user .exists
266
266
assert user .name == "sshd"
267
- assert user .uid == 105
267
+ assert user .uid == 104
268
268
assert user .gid == 65534
269
269
assert user .group == "nogroup"
270
270
assert user .gids == [65534 ]
@@ -359,10 +359,10 @@ def test_ansible_unavailable(host):
359
359
assert expected in str (excinfo .value )
360
360
361
361
362
- @pytest .mark .testinfra_hosts ("ansible://debian_buster " )
362
+ @pytest .mark .testinfra_hosts ("ansible://debian_bullseye " )
363
363
def test_ansible_module (host ):
364
364
setup = host .ansible ("setup" )["ansible_facts" ]
365
- assert setup ["ansible_lsb" ]["codename" ] == "buster "
365
+ assert setup ["ansible_lsb" ]["codename" ] == "bullseye "
366
366
passwd = host .ansible ("file" , "path=/etc/passwd state=file" )
367
367
assert passwd ["changed" ] is False
368
368
assert passwd ["gid" ] == 0
@@ -379,11 +379,11 @@ def test_ansible_module(host):
379
379
assert variables ["myvar" ] == "foo"
380
380
assert variables ["myhostvar" ] == "bar"
381
381
assert variables ["mygroupvar" ] == "qux"
382
- assert variables ["inventory_hostname" ] == "debian_buster "
382
+ assert variables ["inventory_hostname" ] == "debian_bullseye "
383
383
assert variables ["group_names" ] == ["testgroup" ]
384
384
assert variables ["groups" ] == {
385
- "all" : ["debian_buster " ],
386
- "testgroup" : ["debian_buster " ],
385
+ "all" : ["debian_bullseye " ],
386
+ "testgroup" : ["debian_bullseye " ],
387
387
}
388
388
389
389
with pytest .raises (host .ansible .AnsibleException ) as excinfo :
@@ -394,14 +394,16 @@ def test_ansible_module(host):
394
394
host .ansible ("command" , "zzz" , check = False )
395
395
except host .ansible .AnsibleException as exc :
396
396
assert exc .result ["rc" ] == 2
397
- # notez que the debian buster container is set to LANG=fr_FR
397
+ # notez que the debian bullseye container is set to LANG=fr_FR
398
398
assert exc .result ["msg" ] == ("[Errno 2] Aucun fichier ou dossier " "de ce type" )
399
399
400
400
result = host .ansible ("command" , "echo foo" , check = False )
401
401
assert result ["stdout" ] == "foo"
402
402
403
403
404
- @pytest .mark .testinfra_hosts ("ansible://debian_buster" , "ansible://user@debian_buster" )
404
+ @pytest .mark .testinfra_hosts (
405
+ "ansible://debian_bullseye" , "ansible://user@debian_bullseye"
406
+ )
405
407
def test_ansible_module_become (host ):
406
408
user_name = host .user ().name
407
409
assert host .ansible ("shell" , "echo $USER" , check = False )["stdout" ] == user_name
@@ -419,7 +421,7 @@ def test_ansible_module_become(host):
419
421
)
420
422
421
423
422
- @pytest .mark .testinfra_hosts ("ansible://debian_buster " )
424
+ @pytest .mark .testinfra_hosts ("ansible://debian_bullseye " )
423
425
def test_ansible_module_options (host ):
424
426
assert (
425
427
host .ansible (
@@ -532,7 +534,7 @@ def test_sudo_fail_from_root(host):
532
534
assert host .user ().name == "root"
533
535
534
536
535
- @pytest .mark .testinfra_hosts ("docker://user@debian_buster " )
537
+ @pytest .mark .testinfra_hosts ("docker://user@debian_bullseye " )
536
538
def test_sudo_to_root (host ):
537
539
assert host .user ().name == "user"
538
540
with host .sudo ():
@@ -550,9 +552,9 @@ def test_command_execution(host):
550
552
551
553
def test_pip_package (host ):
552
554
with pytest .warns (DeprecationWarning ):
553
- assert host .pip_package .get_packages ()["pip" ]["version" ] == "18.1 "
555
+ assert host .pip_package .get_packages ()["pip" ]["version" ] == "20.3.4 "
554
556
pytest_package = host .pip_package .get_packages (pip_path = "/v/bin/pip" )["pytest" ]
555
- assert pytest_package ["version" ].startswith ("2 ." )
557
+ assert pytest_package ["version" ].startswith ("5 ." )
556
558
with pytest .warns (DeprecationWarning ):
557
559
outdated = host .pip_package .get_outdated_packages (pip_path = "/v/bin/pip" )[
558
560
"pytest"
@@ -565,13 +567,13 @@ def test_pip_package(host):
565
567
566
568
def test_pip (host ):
567
569
# get_packages
568
- assert host .pip .get_packages ()["pip" ]["version" ] == "18.1 "
570
+ assert host .pip .get_packages ()["pip" ]["version" ] == "20.3.4 "
569
571
pytest_package = host .pip .get_packages (pip_path = "/v/bin/pip" )["pytest" ]
570
- assert pytest_package ["version" ].startswith ("2 ." )
572
+ assert pytest_package ["version" ].startswith ("5 ." )
571
573
# outdated
572
574
outdated = host .pip .get_outdated_packages (pip_path = "/v/bin/pip" )["pytest" ]
573
575
assert outdated ["current" ] == pytest_package ["version" ]
574
- assert int (outdated ["latest" ].split ("." )[0 ]) > 2
576
+ assert int (outdated ["latest" ].split ("." )[0 ]) >= 6
575
577
# check
576
578
assert host .pip .check ().succeeded
577
579
# is_installed
@@ -580,8 +582,8 @@ def test_pip(host):
580
582
pytest_package = host .pip ("pytest" , pip_path = "/v/bin/pip" )
581
583
assert pytest_package .is_installed
582
584
# version
583
- assert host .pip ("pip" ).version == "18.1 "
584
- assert pytest_package .version .startswith ("2 ." )
585
+ assert host .pip ("pip" ).version == "20.3.4 "
586
+ assert pytest_package .version .startswith ("5 ." )
585
587
assert host .pip ("does_not_exist" ).version == ""
586
588
587
589
@@ -667,16 +669,10 @@ def test_addr(host):
667
669
assert isinstance (ip_address (ip ), (IPv4Address , IPv6Address ))
668
670
669
671
670
- @pytest .mark .testinfra_hosts ("ansible://debian_buster " )
672
+ @pytest .mark .testinfra_hosts ("ansible://debian_bullseye " )
671
673
def test_addr_namespace (host ):
672
674
namespace_lookup = host .addr ("localhost" , "ns1" )
673
- # ns1 network namespace does not exist so everything is false
674
675
assert not namespace_lookup .namespace_exists
675
- assert not namespace_lookup .is_reachable
676
- assert not namespace_lookup .is_resolvable
677
- with pytest .raises (NotImplementedError ):
678
- # nc is not available so an error is raised
679
- assert not namespace_lookup .port ("443" ).is_reachable
680
676
681
677
682
678
@pytest .mark .parametrize (
0 commit comments