| 361 | #[ignore] |
| 362 | #[tokio::test] |
| 363 | async fn test_upload() { |
| 364 | use crate::executor::ExecutorConfig; |
| 365 | use crate::executor::config::OrchestratorConfig; |
| 366 | |
| 367 | let orchestrator_config = OrchestratorConfig { |
| 368 | upload_url: Url::parse("change me").unwrap(), |
| 369 | profile_folder: Some(PathBuf::from(format!( |
| 370 | "{}/src/uploader/samples/adrien-python-test", |
| 371 | env!("CARGO_MANIFEST_DIR") |
| 372 | ))), |
| 373 | ..OrchestratorConfig::test() |
| 374 | }; |
| 375 | let profile_folder = PathBuf::from(format!( |
| 376 | "{}/src/uploader/samples/adrien-python-test", |
| 377 | env!("CARGO_MANIFEST_DIR") |
| 378 | )); |
| 379 | let executor_config = ExecutorConfig { |
| 380 | command: "pytest tests/ --codspeed".into(), |
| 381 | ..ExecutorConfig::test() |
| 382 | }; |
| 383 | async_with_vars( |
| 384 | [ |
| 385 | ("GITHUB_ACTIONS", Some("true")), |
| 386 | ("GITHUB_ACTOR_ID", Some("19605940")), |
| 387 | ("GITHUB_ACTOR", Some("adriencaccia")), |
| 388 | ("GITHUB_BASE_REF", Some("main")), |
| 389 | ("GITHUB_EVENT_NAME", Some("pull_request")), |
| 390 | ( |
| 391 | "GITHUB_EVENT_PATH", |
| 392 | Some( |
| 393 | format!( |
| 394 | "{}/src/uploader/samples/pr-event.json", |
| 395 | env!("CARGO_MANIFEST_DIR") |
| 396 | ) |
| 397 | .as_str(), |
| 398 | ), |
| 399 | ), |
| 400 | ("GITHUB_HEAD_REF", Some("feat/codspeed-runner")), |
| 401 | ("GITHUB_JOB", Some("log-env")), |
| 402 | ("GITHUB_REF", Some("refs/pull/22/merge")), |
| 403 | ("GITHUB_REPOSITORY", Some("my-org/adrien-python-test")), |
| 404 | ("GITHUB_RUN_ID", Some("6957110437")), |
| 405 | ( |
| 406 | "GITHUB_SHA", |
| 407 | Some("5bd77cb0da72bef094893ed45fb793ff16ecfbe3"), |
| 408 | ), |
| 409 | ("VERSION", Some("0.1.0")), |
| 410 | ], |
| 411 | async { |
| 412 | let api_client = CodSpeedAPIClient::create_test_client(); |
| 413 | let orchestrator = Orchestrator::new(orchestrator_config, &api_client) |
| 414 | .await |
| 415 | .expect("Failed to create Orchestrator for test"); |
| 416 | let execution_context = ExecutionContext::new(executor_config, profile_folder); |
| 417 | let run_part_suffix = |
| 418 | BTreeMap::from([("executor".to_string(), Value::from("valgrind"))]); |
| 419 | upload( |
| 420 | &orchestrator, |