-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
test(http): cover current config over install manifest opts #9915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7d6ec09
fe38cb2
05bbba8
11abb79
178cd63
7f82e80
3998de6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,55 @@ | ||||||||||||||||||||||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # Regression test for https://github.com/jdx/mise/discussions/8880 | ||||||||||||||||||||||||||||||||||||||
| # Current config options must override stale install-manifest options for HTTP | ||||||||||||||||||||||||||||||||||||||
| # version listings. | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| VERSION_LIST_DIR="$TMPDIR/http-version-list-opts" | ||||||||||||||||||||||||||||||||||||||
| mkdir -p "$VERSION_LIST_DIR" | ||||||||||||||||||||||||||||||||||||||
| cat <<'JSON' >"$VERSION_LIST_DIR/versions.json" | ||||||||||||||||||||||||||||||||||||||
| {"old":["0.1.0"],"current":["1.0.0","2.0.0"]} | ||||||||||||||||||||||||||||||||||||||
| JSON | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| HTTP_PORT_FILE="$TMPDIR/http_version_list_port" | ||||||||||||||||||||||||||||||||||||||
| python3 -c " | ||||||||||||||||||||||||||||||||||||||
| import http.server, socketserver | ||||||||||||||||||||||||||||||||||||||
| s = socketserver.TCPServer(('', 0), lambda *a: http.server.SimpleHTTPRequestHandler(*a, directory='$VERSION_LIST_DIR')) | ||||||||||||||||||||||||||||||||||||||
| with open('$HTTP_PORT_FILE', 'w') as f: | ||||||||||||||||||||||||||||||||||||||
| f.write(str(s.server_address[1])) | ||||||||||||||||||||||||||||||||||||||
| s.serve_forever() | ||||||||||||||||||||||||||||||||||||||
| " & | ||||||||||||||||||||||||||||||||||||||
| HTTP_SERVER_PID=$! | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| wait_for_file "$HTTP_PORT_FILE" "HTTP test server port file" 30 "$HTTP_SERVER_PID" | ||||||||||||||||||||||||||||||||||||||
| HTTP_PORT=$(cat "$HTTP_PORT_FILE") | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| cleanup() { | ||||||||||||||||||||||||||||||||||||||
| kill $HTTP_SERVER_PID 2>/dev/null || true | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| trap cleanup EXIT | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+21
to
+29
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if ! curl --retry 5 --retry-connrefused --retry-delay 1 -fsS "http://localhost:$HTTP_PORT/versions.json" >/dev/null; then | ||||||||||||||||||||||||||||||||||||||
| fail "HTTP server failed to respond" | ||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| mkdir -p "$MISE_DATA_DIR/installs" | ||||||||||||||||||||||||||||||||||||||
| cat <<EOF >"$MISE_DATA_DIR/installs/.mise-installs.toml" | ||||||||||||||||||||||||||||||||||||||
| [http-tool-opts] | ||||||||||||||||||||||||||||||||||||||
| short = "http:tool-opts" | ||||||||||||||||||||||||||||||||||||||
| full = "http:tool-opts" | ||||||||||||||||||||||||||||||||||||||
| explicit_backend = true | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| [http-tool-opts.opts] | ||||||||||||||||||||||||||||||||||||||
| version_list_url = "http://localhost:$HTTP_PORT/versions.json" | ||||||||||||||||||||||||||||||||||||||
| version_json_path = ".old" | ||||||||||||||||||||||||||||||||||||||
| EOF | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| cat <<EOF >mise.toml | ||||||||||||||||||||||||||||||||||||||
| [tools."http:tool-opts"] | ||||||||||||||||||||||||||||||||||||||
| version = "1.0.0" | ||||||||||||||||||||||||||||||||||||||
| version_list_url = "http://localhost:$HTTP_PORT/versions.json" | ||||||||||||||||||||||||||||||||||||||
| version_json_path = ".current" | ||||||||||||||||||||||||||||||||||||||
| EOF | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| assert "mise ls-remote http:tool-opts" "1.0.0 | ||||||||||||||||||||||||||||||||||||||
| 2.0.0" | ||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.