Skip to content

Commit

Permalink
fix(turborepo): Turbostate deserialization (#4712)
Browse files Browse the repository at this point in the history
### Description

Accidentally left the key as `remote_config` on the Go side instead of
`api_client_config`

### Testing Instructions

Tested locally with ``.cram_env/bin/prysk --shell=`which bash`
tests/api-client-config.t``
  • Loading branch information
NicholasLYang committed Apr 26, 2023
1 parent 317c49a commit d636cd4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cli/internal/turbostate/turbostate.go
Expand Up @@ -89,7 +89,7 @@ type ParsedArgsFromRust struct {

// ExecutionState is the entire state of a turbo execution that is passed from the Rust shim.
type ExecutionState struct {
APIClientConfig APIClientConfig `json:"remote_config"`
APIClientConfig APIClientConfig `json:"api_client_config"`
CLIArgs ParsedArgsFromRust `json:"cli_args"`
}

Expand Down
4 changes: 2 additions & 2 deletions crates/turborepo-lib/src/execution_state.rs
Expand Up @@ -29,7 +29,7 @@ impl<'a> TryFrom<&'a CommandBase> for ExecutionState<'a> {
let client_config = base.client_config()?;
let args = base.args();

let remote_config = APIClientConfig {
let api_client_config = APIClientConfig {
token: user_config.token(),
team_id: repo_config.team_id(),
team_slug: repo_config.team_slug(),
Expand All @@ -39,7 +39,7 @@ impl<'a> TryFrom<&'a CommandBase> for ExecutionState<'a> {
};

Ok(ExecutionState {
api_client_config: remote_config,
api_client_config,
cli_args: base.args(),
})
}
Expand Down
18 changes: 9 additions & 9 deletions turborepo-tests/integration/tests/api-client-config.t
Expand Up @@ -3,7 +3,7 @@ Setup
$ . ${TESTDIR}/_helpers/setup_monorepo.sh $(pwd)

Run test run
$ ${TURBO} run build --__test-run | jq .remote_config
$ ${TURBO} run build --__test-run | jq .api_client_config
{
"token": null,
"team_id": null,
Expand All @@ -14,29 +14,29 @@ Run test run
}

Run test run with api overloaded
$ ${TURBO} run build --__test-run --api http://localhost:8000 | jq .remote_config.api_url
null
$ ${TURBO} run build --__test-run --api http://localhost:8000 | jq .api_client_config.api_url
"http://localhost:8000"

Run test run with token overloaded
$ ${TURBO} run build --__test-run --token 1234567890 | jq .remote_config.token
$ ${TURBO} run build --__test-run --token 1234567890 | jq .api_client_config.token
"1234567890"

Run test run with token overloaded from both TURBO_TOKEN and VERCEL_ARTIFACTS_TOKEN
$ TURBO_TOKEN=turbo VERCEL_ARTIFACTS_TOKEN=vercel ${TURBO} run build --__test-run | jq .remote_config.token
$ TURBO_TOKEN=turbo VERCEL_ARTIFACTS_TOKEN=vercel ${TURBO} run build --__test-run | jq .api_client_config.token
"vercel"

Run test run with team overloaded
$ ${TURBO} run build --__test-run --team vercel | jq .remote_config.team_slug
$ ${TURBO} run build --__test-run --team vercel | jq .api_client_config.team_slug
"vercel"

Run test run with team overloaded from both env and flag (flag should take precedence)
$ TURBO_TEAM=vercel ${TURBO} run build --__test-run --team turbo | jq .remote_config.team_slug
$ TURBO_TEAM=vercel ${TURBO} run build --__test-run --team turbo | jq .api_client_config.team_slug
"turbo"

Run test run with remote cache timeout env variable set
$ TURBO_REMOTE_CACHE_TIMEOUT=123 ${TURBO} run build --__test-run | jq .remote_config.timeout
$ TURBO_REMOTE_CACHE_TIMEOUT=123 ${TURBO} run build --__test-run | jq .api_client_config.timeout
123

Run test run with remote cache timeout from both env and flag (flag should take precedence)
$ TURBO_REMOTE_CACHE_TIMEOUT=123 ${TURBO} run build --__test-run --remote-cache-timeout 456 | jq .remote_config.timeout
$ TURBO_REMOTE_CACHE_TIMEOUT=123 ${TURBO} run build --__test-run --remote-cache-timeout 456 | jq .api_client_config.timeout
456

0 comments on commit d636cd4

Please sign in to comment.