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
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ jobs:
if: ${{ !cancelled() }}
run: make check-schema

- name: Check the mock API's OpenAPI spec is up to date
if: ${{ !cancelled() }}
run: make check-openapi-spec

legacy-php:
runs-on: ubuntu-latest

Expand Down
2 changes: 2 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ Tests use github.com/stretchr/testify for assertions. Table-driven tests are pre

Integration tests (`integration-tests/`) call `t.Parallel()`, so they must not share state: no `t.Setenv` or unsynchronized package variables, and use `cmdFactory.useConfig` to change the CLI config file. Write output with `t.Log` (e.g. `mockapi.RequestLogger`), not to stdout or stderr: it is then attributed to its test, and shown only on failure or with `-v`. Tests of environment operations use `setUpProject`, and tests of Git commands (push, clone, fetch) use `setUpGitProject`, which also serves a bare repository over the mock SSH server. Tests of other SSH commands use `serveSSH` with an app from `sshEnv`, and fake remote executables from `remoteEnv`. The mock SSH server can also serve SFTP (`SFTPDir`) and forward connections (`DialTCP`, `ListenUnix`); tests of commands that start background processes (tunnels) must make sure they exit.

The mock API (`pkg/mockapi`) validates each successful request and response against the API's OpenAPI spec (`pkg/mockapi/openapi.json`, refreshed with `make update-openapi-spec`; CI's non-blocking `lint-upstream` job checks that it is up to date), and reports failures through the test. Responses may leave out required properties. Routes that are not in the spec are listed in `notInSpec`, and differences between the spec and the API are patched in `patchSpec`.

`make test-integration-coverage` runs the integration tests with a CLI built with `-cover`, and prints a report (`scripts/coverage-report`): Go statement coverage per package, and the commands and command-specific options that the tests run (logged by `buildCommand` when `INTEGRATION_TESTS_ARGS_LOG` is set). CI runs both integration test runs this way, and writes the report to the job summary.

### Configuration
Expand Down
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,16 @@ update-schema: ## Refresh the embedded Flex config schema from meta.upsun.com
check-schema: update-schema
git diff --exit-code -- internal/schema/upsun-config-schema.json

# The API's OpenAPI spec, used to validate the mock API in tests, is from https://meta.upsun.com/openapi-spec.
.PHONY: update-openapi-spec
update-openapi-spec: ## Refresh the OpenAPI spec used by the mock API
cd pkg/mockapi && go run gen.go

# Fail if the OpenAPI spec is stale. Only a summary is printed, as the diff can be large.
.PHONY: check-openapi-spec
check-openapi-spec: update-openapi-spec
git diff --exit-code --stat -- pkg/mockapi/openapi.json

# Installs dev dependencies, which a phar build removes. PHPStan's binary marks that they are installed.
.PHONY: composer-dev
composer-dev: legacy/vendor/bin/phpstan
Expand Down
7 changes: 7 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
github.com/charmbracelet/x/ansi v0.11.9
github.com/dlclark/regexp2/v2 v2.9.1
github.com/fatih/color v1.19.0
github.com/getkin/kin-openapi v0.151.0
github.com/go-chi/chi/v5 v5.5.0
github.com/go-playground/validator/v10 v10.30.5
github.com/godbus/dbus/v5 v5.2.4
Expand Down Expand Up @@ -72,12 +73,15 @@ require (
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.9.2 // indirect
github.com/go-git/go-git/v5 v5.19.3 // indirect
github.com/go-openapi/jsonpointer v0.22.5 // indirect
github.com/go-openapi/swag/jsonname v0.25.5 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/google/cel-go v0.31.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/h2non/filetype v1.1.3 // indirect
github.com/hashicorp/go-version v1.9.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
Expand All @@ -103,12 +107,15 @@ require (
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/muesli/termenv v0.16.0 // indirect
github.com/nwaples/rardecode/v2 v2.2.2 // indirect
github.com/oasdiff/yaml v0.1.1 // indirect
github.com/oasdiff/yaml3 v0.0.14 // indirect
github.com/pierrec/lz4/v4 v4.1.26 // indirect
github.com/pjbgf/sha1cd v0.7.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rs/zerolog v1.35.1 // indirect
github.com/sagikazarmark/locafero v0.12.0 // indirect
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 // indirect
github.com/sergi/go-diff v1.4.0 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/skeema/knownhosts v1.3.2 // indirect
Expand Down
18 changes: 18 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ github.com/danieljoos/wincred v1.2.3 h1:v7dZC2x32Ut3nEfRH+vhoZGvN72+dQ/snVXo/vMF
github.com/danieljoos/wincred v1.2.3/go.mod h1:6qqX0WNrS4RzPZ1tnroDzq9kY3fu1KwE7MRLQK4X0bs=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI=
github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/dlclark/regexp2/v2 v2.9.1 h1:q6bZW/NN9VodqMjYXpuic2lZxdHPfFTzGS+MJxIJmKQ=
github.com/dlclark/regexp2/v2 v2.9.1/go.mod h1:avUrQvPaLz2DrFNHJF0taWAFFX2C1GMSSoeiqFjcBmU=
github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 h1:2tV76y6Q9BB+NEBasnqvs7e49aEBFI8ejC89PSnWH+4=
Expand All @@ -94,6 +96,8 @@ github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/gabriel-vasile/mimetype v1.4.15 h1:05iP/CYtZ/w455R/KZM6rZ5ieAdh99UPtd+d3YzLmaI=
github.com/gabriel-vasile/mimetype v1.4.15/go.mod h1:azpTcoLcDZRNgFou5j+APrqQx9HqVPWa6ijYQIIVswQ=
github.com/getkin/kin-openapi v0.151.0 h1:p8NIstL53h620DnlO9R4pR4QRkEzJ3jbw9flb4kc1hg=
github.com/getkin/kin-openapi v0.151.0/go.mod h1:1+BHDzstro+P5CKtPy1X4PfofnFgmRe6uvMy9+r9fKY=
github.com/getsentry/sentry-go v0.46.0 h1:mbdDaarbUdOt9X+dx6kDdntkShLEX3/+KyOsVDTPDj0=
github.com/getsentry/sentry-go v0.46.0/go.mod h1:evVbw2qotNUdYG8KxXbAdjOQWWvWIwKxpjdZZIvcIPw=
github.com/gitleaks/go-gitdiff v0.9.1 h1:ni6z6/3i9ODT685OLCTf+s/ERlWUNWQF4x1pvoNICw0=
Expand All @@ -112,6 +116,12 @@ github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMj
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
github.com/go-git/go-git/v5 v5.19.3 h1:qHttbZ+Am7wEjdTpR1XMQ4rl42FK9SIXzZ4o9x7s6M4=
github.com/go-git/go-git/v5 v5.19.3/go.mod h1:Ye4C8dVigkqrv9UsB4NMdSLV4yAIkLiIhW61gcOyhl4=
github.com/go-openapi/jsonpointer v0.22.5 h1:8on/0Yp4uTb9f4XvTrM2+1CPrV05QPZXu+rvu2o9jcA=
github.com/go-openapi/jsonpointer v0.22.5/go.mod h1:gyUR3sCvGSWchA2sUBJGluYMbe1zazrYWIkWPjjMUY0=
github.com/go-openapi/swag/jsonname v0.25.5 h1:8p150i44rv/Drip4vWI3kGi9+4W9TdI3US3uUYSFhSo=
github.com/go-openapi/swag/jsonname v0.25.5/go.mod h1:jNqqikyiAK56uS7n8sLkdaNY/uq6+D2m2LANat09pKU=
github.com/go-openapi/testify/v2 v2.4.0 h1:8nsPrHVCWkQ4p8h1EsRVymA2XABB4OT40gcvAu+voFM=
github.com/go-openapi/testify/v2 v2.4.0/go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
Expand All @@ -137,6 +147,8 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/h2non/filetype v1.1.3 h1:FKkx9QbD7HR/zjK1Ia5XiBsq9zdLi5Kf3zGyFTAFkGg=
github.com/h2non/filetype v1.1.3/go.mod h1:319b3zT68BvV+WRj7cwy856M2ehB3HqNOt6sy1HndBY=
github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaXPSCnA=
Expand Down Expand Up @@ -205,6 +217,10 @@ github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
github.com/nwaples/rardecode/v2 v2.2.2 h1:/5oL8dzYivRM/tqX9VcTSWfbpwcbwKG1QtSJr3b3KcU=
github.com/nwaples/rardecode/v2 v2.2.2/go.mod h1:7uz379lSxPe6j9nvzxUZ+n7mnJNgjsRNb6IbvGVHRmw=
github.com/oasdiff/yaml v0.1.1 h1:6nHx+pn9gBRM6YpBlFZFQGCCd1nuvqOBtTD3KKTgGxY=
github.com/oasdiff/yaml v0.1.1/go.mod h1:EYJNoyktvWMJ0Hmhx+6qTaqMOsalUaRGT8Sj1hNcegU=
github.com/oasdiff/yaml3 v0.0.14 h1:aLJee3hxBK2H5wdXd9iPcIXb93Nty1Ge0pT171eHtkw=
github.com/oasdiff/yaml3 v0.0.14/go.mod h1:csto2xfDjYccdUn/yw/bPjj/cYTdp6HtFA0J4TWG+gg=
github.com/oklog/ulid/v2 v2.1.2 h1:IEclFb9JNvzYA6MW2SCxbLzcHTVsfqm3PrqGQJH5zec=
github.com/oklog/ulid/v2 v2.1.2/go.mod h1:rcEKHmBBKfef9DhnvX7y1HZBYxjXb0cP5ExxNsTT1QQ=
github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8=
Expand Down Expand Up @@ -232,6 +248,8 @@ github.com/rs/zerolog v1.35.1/go.mod h1:EjML9kdfa/RMA7h/6z6pYmq1ykOuA8/mjWaEvGI+
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4=
github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI=
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 h1:1EYB5IzjZawrrnELUi78f9fPu57HuXjmddZPjrls/28=
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw=
github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/app_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestAppList(t *testing.T) {
WebApps: map[string]mockapi.App{
"app": {Name: "app", Type: "golang:1.23", Size: "AUTO"},
},
Services: map[string]mockapi.App{},
Services: map[string]mockapi.Service{},
Routes: map[string]any{},
Workers: map[string]mockapi.Worker{
"app--worker1": {
Expand Down Expand Up @@ -98,7 +98,7 @@ func TestAppListEmptyLocalConfig(t *testing.T) {
main := makeEnv(layoutProjectID, "main", "production", "active", nil)
main.SetCurrentDeployment(&mockapi.Deployment{
WebApps: map[string]mockapi.App{"app": {Name: "app", Type: "golang:1.23", Size: "AUTO"}},
Services: map[string]mockapi.App{},
Services: map[string]mockapi.Service{},
Routes: map[string]any{},
Workers: map[string]mockapi.Worker{},
Links: mockapi.MakeHALLinks("self=/projects/" + layoutProjectID + "/environments/main/deployment/current"),
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/db_ssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ func setUpDBProject(t *testing.T, clients map[string]string) *testProject {
WebApps: map[string]mockapi.App{
"app": {Name: "app", Type: "golang:1.23", Size: "M", Mounts: map[string]mockapi.Mount{}},
},
Services: map[string]mockapi.App{
"db": {Name: "db", Type: "mariadb:11.4", Size: "M", Disk: 1024},
"pg": {Name: "pg", Type: "postgresql:16", Size: "M", Disk: 2048},
Services: map[string]mockapi.Service{
"db": {Type: "mariadb:11.4", Size: "M", Disk: 1024},
"pg": {Type: "postgresql:16", Size: "M", Disk: 2048},
},
}))
p.serveSSH(t, mockssh.ExecHandler(t.TempDir(), remoteEnv(t, clients, dbRelationships())))
Expand Down
5 changes: 4 additions & 1 deletion integration-tests/domain_add_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ func TestDomainAdd(t *testing.T) {
require.NoError(t, err)
require.NoError(t, json.Unmarshal(body, &captured))
w.WriteHeader(http.StatusCreated)
_ = json.NewEncoder(w).Encode(map[string]any{"name": captured["name"]})
_ = json.NewEncoder(w).Encode(map[string]any{
"status": "created", "code": http.StatusCreated,
"_embedded": map[string]any{"entity": map[string]any{"name": captured["name"]}},
})
})

apiServer := httptest.NewServer(apiHandler)
Expand Down
4 changes: 4 additions & 0 deletions integration-tests/domain_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ func TestDomainUpdateProjectScope(t *testing.T) {
_ = json.NewEncoder(w).Encode(map[string]any{
"id": "example.com",
"name": "example.com",
"type": "production",
"is_default": false,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z",
"ssl": map[string]any{
Expand Down Expand Up @@ -111,6 +113,8 @@ func TestDomainGetProjectScope(t *testing.T) {
_ = json.NewEncoder(w).Encode(map[string]any{
"id": "example.com",
"name": "example.com",
"type": "production",
"is_default": false,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z",
"ssl": map[string]any{
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/environment_http_access_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestEnvironmentHTTPAccess(t *testing.T) {
assert.Contains(t, stdOut, "is_enabled: false")
httpAccess := p.env("main").HTTPAccess
assert.Equal(t, false, httpAccess["is_enabled"])
assert.Nil(t, httpAccess["basic_auth"])
assert.Equal(t, map[string]any{}, httpAccess["basic_auth"])
assert.Len(t, httpAccess["addresses"], 2)

_, stdErr, err = p.f.RunCombinedOutput("httpaccess", "-p", layoutProjectID, "-e", "main", "--auth", "user1:short")
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/environment_log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ func TestEnvironmentLogAPI(t *testing.T) {
}
mainEnv.SetCurrentDeployment(&mockapi.Deployment{
WebApps: map[string]mockapi.App{"app": webApp("app"), "admin": webApp("admin")},
Services: map[string]mockapi.App{
"db": {Name: "db", Type: "mariadb:11.4", Size: "S", Disk: 1024},
Services: map[string]mockapi.Service{
"db": {Type: "mariadb:11.4", Size: "S", Disk: 1024},
},
Workers: map[string]mockapi.Worker{
"app--queue": worker("app--queue"),
Expand Down Expand Up @@ -321,7 +321,7 @@ func TestEnvironmentLogSSHFallback(t *testing.T) {
WebApps: map[string]mockapi.App{
"app": {Name: "app", Type: "golang:1.23", Size: "M", Disk: 2048, Mounts: map[string]mockapi.Mount{}},
},
Services: map[string]mockapi.App{},
Services: map[string]mockapi.Service{},
Workers: map[string]mockapi.Worker{},
Routes: mockRoutes(),
Links: mockapi.MakeHALLinks("self=/projects/" + projectID + "/environments/main/deployment/current"),
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/environment_relationships_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func TestRelationshipsRemote(t *testing.T) {
WebApps: map[string]mockapi.App{
"app": {Name: "app", Type: "golang:1.23", Size: "M", Disk: 2048, Mounts: map[string]mockapi.Mount{}},
},
Services: map[string]mockapi.App{},
Services: map[string]mockapi.Service{},
Workers: map[string]mockapi.Worker{},
Routes: make(map[string]any),
Links: mockapi.MakeHALLinks("self=/projects/" + projectID + "/environments/main/deployment/current"),
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/environment_xdebug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestEnvironmentXdebug(t *testing.T) {
env := makeEnv(projectID, name, "development", "active", nil)
env.SetCurrentDeployment(&mockapi.Deployment{
WebApps: map[string]mockapi.App{"app": app},
Services: map[string]mockapi.App{},
Services: map[string]mockapi.Service{},
Workers: map[string]mockapi.Worker{
"app--queue": {App: mockapi.App{Name: "app--queue", Type: app.Type, Runtime: app.Runtime, Stack: app.Stack}},
},
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/metrics_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func setupMetricsTest(t *testing.T, withStorage, withStorageMount bool) (f *cmdF
WebApps: map[string]mockapi.App{
"app": app,
},
Services: map[string]mockapi.App{
"db": {Name: "db", Type: "mariadb:11.4", Size: "AUTO"},
Services: map[string]mockapi.Service{
"db": {Type: "mariadb:11.4", Size: "AUTO"},
},
Workers: map[string]mockapi.Worker{},
Routes: map[string]any{},
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestMetricsLatest(t *testing.T) {
main := makeEnv(projectID, "main", "production", "active", nil)
main.SetCurrentDeployment(&mockapi.Deployment{
WebApps: map[string]mockapi.App{"app": {Name: "app", Type: "golang:1.23", Size: "AUTO"}},
Services: map[string]mockapi.App{"db": {Name: "db", Type: "mariadb:11.4", Size: "AUTO"}},
Services: map[string]mockapi.Service{"db": {Type: "mariadb:11.4", Size: "AUTO"}},
Workers: map[string]mockapi.Worker{},
Routes: map[string]any{},
Links: mockapi.MakeHALLinks("self=" + envPath + "/deployment/current"),
Expand Down Expand Up @@ -155,7 +155,7 @@ func TestMetricsMemory(t *testing.T) {
main := makeEnv(projectID, "main", "production", "active", nil)
main.SetCurrentDeployment(&mockapi.Deployment{
WebApps: map[string]mockapi.App{"app": {Name: "app", Type: "golang:1.23", Size: "AUTO"}},
Services: map[string]mockapi.App{},
Services: map[string]mockapi.Service{},
Workers: map[string]mockapi.Worker{},
Routes: map[string]any{},
Links: mockapi.MakeHALLinks("self=" + envPath + "/deployment/current"),
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/mount_download_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestMountDownloadToNewRelativeTarget(t *testing.T) {
"/var/log": {Source: "storage", SourcePath: "logs"},
}},
},
Services: map[string]mockapi.App{},
Services: map[string]mockapi.Service{},
Routes: map[string]any{},
Workers: map[string]mockapi.Worker{},
Links: mockapi.MakeHALLinks("self=/projects/" + projectID + "/environments/main/deployment/current"),
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/mount_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestMountList(t *testing.T) {
"/public/sites/default/files": {Source: "local", SourcePath: "files"},
}},
},
Services: map[string]mockapi.App{},
Services: map[string]mockapi.Service{},
Routes: map[string]any{},
Workers: map[string]mockapi.Worker{},
Links: mockapi.MakeHALLinks("self=/projects/" + projectID + "/environments/main/deployment/current"),
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/org_user_projects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestOrgUserProjects(t *testing.T) {
"id": "member-1",
"organization_id": orgID,
"user_id": targetUserID,
"permissions": []string{"members:viewer"},
"permissions": []string{"members"},
"owner": false,
"created_at": "2024-01-01T00:00:00+00:00",
"updated_at": "2024-01-01T00:00:00+00:00",
Expand All @@ -76,15 +76,15 @@ func TestOrgUserProjects(t *testing.T) {
"id": "member-2",
"organization_id": orgID,
"user_id": missingUserID,
"permissions": []string{"members:viewer"},
"permissions": []string{"members"},
"owner": false,
"created_at": "2024-01-01T00:00:00+00:00",
"updated_at": "2024-01-01T00:00:00+00:00",
},
},
"_links": map[string]any{
"self": map[string]string{"href": "/organizations/" + orgID + "/members"},
"ref:users:0": map[string]string{"href": "/ref/users?in=" + targetUserID},
"ref:users:0": map[string]string{"href": "/ref/users?in=" + targetUserID + "&sig=mock-signature"},
// Deliberately omit missingUserID from the ref:users lookup.
},
}
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/project_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func remoteEnv(t *testing.T, scripts map[string]string, relationships map[string
func sshEnv(d *mockapi.Deployment) *mockapi.Environment {
env := makeEnv(layoutProjectID, "main", "production", "active", nil)
if d.Services == nil {
d.Services = map[string]mockapi.App{}
d.Services = map[string]mockapi.Service{}
}
if d.Workers == nil {
d.Workers = map[string]mockapi.Worker{}
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/resources_get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestResourcesGet(t *testing.T) {
},
}, map[string]any{
"BALANCED": map[string]any{
"0.1": map[string]any{"cpu": "0.1", "memory": "256", "cpu_type": "guaranteed"},
"0.1": map[string]any{"cpu": 0.1, "memory": 256, "cpu_type": "guaranteed"},
},
}))
f := serveAPI(t, apiHandler)
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/resources_set_interactive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ func TestResourcesSet_Interactive(t *testing.T) {
},
}, map[string]any{
"HIGH_CPU": map[string]any{
"0.5": map[string]any{"cpu": "0.5", "memory": "224", "cpu_type": "shared"},
"1": map[string]any{"cpu": "1", "memory": "384", "cpu_type": "shared"},
"0.5": map[string]any{"cpu": 0.5, "memory": 224, "cpu_type": "shared"},
"1": map[string]any{"cpu": 1, "memory": 384, "cpu_type": "shared"},
},
}))
f := serveAPI(t, apiHandler)
Expand Down
Loading
Loading