Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ describe('ActivateStagedRelease', () => {
fireEvent.click(screen.getByRole('button', { name: /Activate/ }));
expect(state.mutateAsync).not.toHaveBeenCalled();
expect(screen.getByText('Activate this release of web?')).toBeTruthy();
const description = screen.getByText(/Everything was installed when this release was staged/);
expect(description.textContent).toMatch(/goes live on all nodes, which restart one at a time\./);
expect(description.textContent).toMatch(/so each node just switches to it\.$/);

fireEvent.click(screen.getByRole('button', { name: 'Activate' }));
expect(state.mutateAsync).toHaveBeenCalledOnce();
Expand All @@ -86,6 +89,20 @@ describe('ActivateStagedRelease', () => {
});
});

it('adds, when activating it again, that a node already running it only restarts', () => {
render(
<QueryClientProvider client={new QueryClient()}>
<ActivateStagedRelease deployment={staged} intent="again" />
</QueryClientProvider>,
);
fireEvent.click(screen.getByRole('button', { name: 'Activate again' }));
expect(screen.getByText('Activate this release of web again?')).toBeTruthy();
const description = screen.getByText(/Everything was installed when this release was staged/);
expect(description.textContent).toMatch(
/so each node just switches to it\. A node already running it restarts without changing anything\.$/,
);
});

it('still reports an activation whose detail was closed before it settled', async () => {
let settle: (value: object) => void = () => {};
state.mutateAsync.mockReturnValue(new Promise((resolve) => (settle = resolve)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,15 @@ export function ActivateStagedRelease({
? (
<>
Deployment <span className="font-mono">{deploymentId}</span>{' '}
goes live again on every node, which restart one at a time. Nothing is installed: each node swaps
back the copy it kept when this release was replaced. A node that no longer keeps it refuses.
goes live again on all nodes, which restart one at a time. Each node kept this release installed
when it was replaced, so it just switches back. A node that no longer keeps it refuses.
</>
)
: (
<>
Deployment <span className="font-mono">{deploymentId}</span>{' '}
goes live on every node, which restart one at a time. Nothing is installed: each node swaps in the
release it staged.{shownIntent === 'again'
goes live on all nodes, which restart one at a time. Everything was installed when this release was
staged, so each node just switches to it.{shownIntent === 'again'
&& ' A node already running it restarts without changing anything.'}
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const activationButton = () => screen.queryByRole('button', { name: /Activate|Ro
describe('StagedReleaseDetail', () => {
it("reads the component's records from the staged one on, wherever they are listed", async () => {
renderDetail([staged]);
await screen.findByText(/Staged: built and installed, but not live/);
await screen.findByText('Staged: built and installed, but not live. Activating it just switches each node to it.');
expect(state.post).toHaveBeenCalledWith(
'/',
expect.objectContaining({
Expand Down Expand Up @@ -142,6 +142,9 @@ describe('StagedReleaseDetail', () => {
expect(await screen.findByText(/then replaced by/)).toBeTruthy();
fireEvent.click(screen.getByRole('button', { name: /Roll back to this release/ }));
expect(screen.getByText('Roll hello back to this release?')).toBeTruthy();
const description = screen.getByText(/Each node kept this release installed when it was replaced/);
expect(description.textContent).toMatch(/goes live again on all nodes, which restart one at a time\./);
expect(description.textContent).toMatch(/so it just switches back\. A node that no longer keeps it refuses\.$/);
fireEvent.click(screen.getByRole('button', { name: 'Roll back to this release' }));
expect(state.mutateAsync.mock.calls[0][0]).toMatchObject({
request: { kind: 'activate', project: 'hello', deploymentId: STAGED_ID },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function StagedReleaseDetail({ deployment }: { deployment: Deployment })
<div className="text-sm text-muted-foreground">
{!release && 'Staged. Checking whether it has been activated…'}
{release?.kind === 'waiting'
&& 'Staged: built and installed, but not live. Activating it makes it live with nothing to install.'}
&& 'Staged: built and installed, but not live. Activating it just switches each node to it.'}
{release?.kind === 'unknown'
&& "Staged. Couldn't read the deployments since, so it may already be live: activating a live release restarts every node without changing anything."}
{release?.kind === 'activating' && (
Expand Down
Loading