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
9 changes: 9 additions & 0 deletions docs/changes/unreleased/1814-updater-acceptance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
kind: fixed
title: updater acceptance follows resolved install paths and current settings
pr: 1814
surface: [build]
invalidates:
- "Updater tests compared the installer's resolved target with its unresolved input path, so successful installs through macOS temporary-directory links failed acceptance. They now compare against the independently resolved target while retaining the content, mode, checksum and timeout checks."
- "The updater terminal drive navigated old settings tabs and searched for the old row label. It now stays in General and selects automatic updates, retaining the row's own hint, on/off checks, widths and navigation bound."
---
13 changes: 11 additions & 2 deletions internal/update/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,11 @@ func TestTimeoutContractC1SlowAssetOutlivesTheCheckClock(t *testing.T) {
}
client := releaseClient(server, "v0.1.0")
client.HTTP.Timeout = CheckTimeout
// Install reports the resolved path; macOS temporary roots can be links.
wantPath, err := filepath.EvalSymlinks(target)
if err != nil {
t.Fatal(err)
}
result, err := Install(context.Background(), InstallOptions{
Client: client, Release: Release{Tag: "v0.2.0", Repository: primaryRepository}, Target: target,
})
Expand All @@ -530,7 +535,7 @@ func TestTimeoutContractC1SlowAssetOutlivesTheCheckClock(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if info.Mode().Perm() != 0o755 || result.Path != target {
if info.Mode().Perm() != 0o755 || result.Path != wantPath {
t.Fatalf("result = %+v mode = %v", result, info.Mode().Perm())
}
if matches, _ := filepath.Glob(filepath.Join(dir, ".codeaf.tmp.*")); len(matches) != 0 {
Expand Down Expand Up @@ -734,6 +739,10 @@ func TestC7CheckedInstallReplacesAtomicallyAndMismatchPreservesTheOriginal(t *te
if err := os.WriteFile(target, []byte("old codeaf"), 0o700); err != nil {
t.Fatal(err)
}
wantPath, err := filepath.EvalSymlinks(target)
if err != nil {
t.Fatal(err)
}
result, err := Install(context.Background(), InstallOptions{
Client: releaseClient(server, "v0.1.1"), Release: Release{Tag: "v0.2.0", Repository: primaryRepository}, Target: target,
})
Expand All @@ -748,7 +757,7 @@ func TestC7CheckedInstallReplacesAtomicallyAndMismatchPreservesTheOriginal(t *te
if row.ok {
want = asset
info, _ := os.Stat(target)
if info.Mode().Perm() != 0o755 || result.Path != target || result.Release.Tag != "v0.2.0" {
if info.Mode().Perm() != 0o755 || result.Path != wantPath || result.Release.Tag != "v0.2.0" {
t.Fatalf("result = %+v mode %o", result, info.Mode().Perm())
}
} else if !strings.Contains(err.Error(), "checksum") {
Expand Down
20 changes: 7 additions & 13 deletions scripts/update-drive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ capture() {
}

# capture_settings <state> <cols> \u2014 the REAL /settings page with the real
# `auto update` row, reached the way a person reaches it: the command, the
# arrow keys that walk the tabs to Workspace, and the down key that walks the
# cursor onto the row. The row is confirmed selected by its OWN hint being on
# `automatic updates` row, reached the way a person reaches it: the command
# opens General, and the down key walks the cursor onto the row.
# The row is confirmed selected by its OWN hint being on
# screen, not by the label merely existing somewhere in the frame.
capture_settings() {
local state="$1" cols="$2"
Expand All @@ -136,14 +136,8 @@ capture_settings() {
tmux -L "$SOCK" send-keys -t "$session" -l "/settings"
tmux -L "$SOCK" send-keys -t "$session" Enter
sleep 2
# THE WORKSPACE TAB, BY THE PANEL'S OWN ARROW KEY: Session, Context,
# Workspace. The panel's type-to-search is deliberately NOT used here — it
# ranks fuzzy matches from every tab, so the row under the cursor is usually
# the wrong one and the sentence drawn under it explains somebody else's
# setting.
tmux -L "$SOCK" send-keys -t "$session" Right
tmux -L "$SOCK" send-keys -t "$session" Right
sleep 2
# GENERAL IS THE INITIAL CATEGORY. Walking right would leave the category
# that owns automatic updates; walk its rows directly instead.
local landed=""
for _ in $(seq 1 24); do
# THE ROW'S OWN HINT IS THE PROOF THE CURSOR IS ON IT: the sheet draws the
Expand Down Expand Up @@ -171,12 +165,12 @@ capture_settings() {
cat "$file" >&2
exit 1
}
grep -q "auto update" "$file" || {
grep -q "automatic updates" "$file" || {
echo "the settings capture at ${cols}c did not draw the auto update row:" >&2
cat "$file" >&2
exit 1
}
grep -q "auto update.*$state" "$file" || {
grep -q "automatic updates.*$state" "$file" || {
echo "the settings capture at ${cols}c did not read $state:" >&2
cat "$file" >&2
exit 1
Expand Down
Loading