Skip to content

Commit

Permalink
XXX debug/amplify testLifecycleOperations
Browse files Browse the repository at this point in the history
  • Loading branch information
martinpitt committed Jul 5, 2023
1 parent 9c649de commit fdd9a1a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Containers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ const ContainerActions = ({ container, healthcheck, onAddNotification, version,
const isRunning = container.State == "running";
const isPaused = container.State === "paused";

utils.debug(container.isSystem, "ContainerActions names", JSON.stringify(container.Names), "status", container.State);

const deleteContainer = (event) => {
setActionsKebabOpen(false);

Expand Down Expand Up @@ -76,13 +78,16 @@ const ContainerActions = ({ container, healthcheck, onAddNotification, version,

const stopContainer = (force) => {
const args = {};
if (force)
args.t = 0;

utils.debug(container.isSystem, "stopContainer", container.Id, "args", JSON.stringify(args));

setActionsKebabOpen(false);

if (force)
args.t = 0;
client.postContainer(container.isSystem, "stop", container.Id, args)
.catch(ex => {
utils.debug(container.isSystem, "stopContainer", container.Id, "failed", JSON.stringify(ex));
const error = cockpit.format(_("Failed to stop container $0"), container.Names);
onAddNotification({ type: 'danger', error, errorDetail: ex.message });
});
Expand Down
3 changes: 3 additions & 0 deletions src/PodActions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import cockpit from 'cockpit';
import { useDialogs } from "dialogs.jsx";

import * as client from './client.js';
import { debug } from './util.js';

const _ = cockpit.gettext;

Expand Down Expand Up @@ -71,6 +72,8 @@ export const PodActions = ({ onAddNotification, pod }) => {
const Dialogs = useDialogs();
const [isOpen, setOpen] = useState(false);

debug(pod.isSystem, "PodActions name", pod.Name, "status", pod.Status);

const dropdownItems = [];
// Possible Pod Statuses can be found here https://github.com/containers/podman/blob/main/libpod/define/podstate.go
if (pod.Status == "Running" || pod.Status == "Paused") {
Expand Down
21 changes: 21 additions & 0 deletions test/check-application
Original file line number Diff line number Diff line change
Expand Up @@ -1155,16 +1155,37 @@ class TestApplication(testlib.MachineCase):
def testLifecycleOperationsUser(self):
self._testLifecycleOperations(False)

def testLifecycleOperationsUser2(self):
self._testLifecycleOperations(False)

def testLifecycleOperationsUser3(self):
self._testLifecycleOperations(False)

def testLifecycleOperationsUser4(self):
self._testLifecycleOperations(False)

def testLifecycleOperationsSystem(self):
self._testLifecycleOperations(True)

def testLifecycleOperationsSystem2(self):
self._testLifecycleOperations(True)

def testLifecycleOperationsSystem3(self):
self._testLifecycleOperations(True)

def testLifecycleOperationsSystem4(self):
self._testLifecycleOperations(True)

def _testLifecycleOperations(self, auth):
b = self.browser

if not auth:
self.allow_browser_errors("Failed to start system podman.socket.*")

self.login()

b.eval_js('window.debugging = "podman"')
b.cdp.trace = True
self.filter_containers('all')

# run a container
Expand Down

0 comments on commit fdd9a1a

Please sign in to comment.