(cephadm_fs, funkypatch)
| 154 | |
| 155 | |
| 156 | def test_deploy_haproxy_container(cephadm_fs, funkypatch): |
| 157 | mocks = _common_patches(funkypatch) |
| 158 | _firewalld = mocks['Firewalld'] |
| 159 | _install_sysctl = mocks['install_sysctl'] |
| 160 | fsid = 'b01dbeef-701d-9abe-0000-e1e5a47004a7' |
| 161 | with with_cephadm_ctx([]) as ctx: |
| 162 | ctx.container_engine = mock_podman() |
| 163 | ctx.fsid = fsid |
| 164 | ctx.name = 'haproxy.yyz' |
| 165 | ctx.image = 'quay.io/lfeuwbo/haproxy:latest' |
| 166 | ctx.reconfig = False |
| 167 | ctx.config_blobs = { |
| 168 | 'config': 'XXXXXXX', |
| 169 | 'keyring': 'YYYYYY', |
| 170 | 'files': { |
| 171 | 'haproxy.cfg': 'bifrost', |
| 172 | }, |
| 173 | } |
| 174 | _cephadm._common_deploy(ctx) |
| 175 | |
| 176 | basedir = pathlib.Path(f'/var/lib/ceph/{fsid}/haproxy.yyz') |
| 177 | assert basedir.is_dir() |
| 178 | with open(basedir / 'unit.run') as f: |
| 179 | runfile_lines = f.read().splitlines() |
| 180 | assert 'podman' in runfile_lines[-1] |
| 181 | assert runfile_lines[-1].endswith( |
| 182 | 'quay.io/lfeuwbo/haproxy:latest haproxy -f /var/lib/haproxy/haproxy.cfg' |
| 183 | ) |
| 184 | assert '--pids-limit' not in runfile_lines[-1] |
| 185 | assert '--user=root' in runfile_lines[-1] |
| 186 | assert f'-v {basedir}/haproxy:/var/lib/haproxy' in runfile_lines[-1] |
| 187 | _firewalld().open_ports.assert_not_called() |
| 188 | assert not (basedir / 'config').exists() |
| 189 | assert not (basedir / 'keyring').exists() |
| 190 | assert (basedir / 'haproxy').is_dir() |
| 191 | si = (basedir / 'haproxy').stat() |
| 192 | assert (si.st_uid, si.st_gid) == (8765, 8765) |
| 193 | with open(basedir / 'haproxy/haproxy.cfg') as f: |
| 194 | assert f.read() == 'bifrost' |
| 195 | si = os.fstat(f.fileno()) |
| 196 | assert (si.st_uid, si.st_gid) == (8765, 8765) |
| 197 | assert _install_sysctl.call_count == 1 |
| 198 | assert len(_install_sysctl.call_args[0][-1].get_sysctl_settings()) > 1 |
| 199 | |
| 200 | |
| 201 | def test_deploy_iscsi_container(cephadm_fs, funkypatch): |
nothing calls this directly
no test coverage detected