Skip to content
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

fix(turborepo): Turbostate deserialization #4712

Merged
merged 2 commits into from Apr 26, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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