MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / test_get_metadata_hash

Function test_get_metadata_hash

src/upload/upload_metadata.rs:28–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26
27 #[test]
28 fn test_get_metadata_hash() {
29 let upload_metadata = UploadMetadata {
30 repository_provider: RepositoryProvider::GitHub,
31 version: Some(LATEST_UPLOAD_METADATA_VERSION),
32 tokenless: true,
33 profile_md5: "jp/k05RKuqP3ERQuIIvx4Q==".into(),
34 profile_encoding: Some("gzip".into()),
35 runner: Runner {
36 name: "codspeed-runner".into(),
37 version: "2.1.0".into(),
38 instruments: vec![InstrumentName::MongoDB],
39 executor: ExecutorName::Valgrind,
40 system_info: SystemInfo::test(),
41 },
42 run_environment: RunEnvironment::GithubActions,
43 commit_hash: "5bd77cb0da72bef094893ed45fb793ff16ecfbe3".into(),
44 allow_empty: false,
45 run_environment_metadata: RunEnvironmentMetadata {
46 ref_: "refs/pull/29/merge".into(),
47 head_ref: Some("chore/native-action-runner".into()),
48 base_ref: Some("main".into()),
49 owner: "CodSpeedHQ".into(),
50 repository: "codspeed-node".into(),
51 event: RunEvent::PullRequest,
52 gh_data: Some(GhData {
53 run_id: "7044765741".into(),
54 job: "codspeed".into(),
55 }),
56 sender: Some(Sender {
57 id: "19605940".into(),
58 login: "adriencaccia".into(),
59 }),
60 gl_data: None,
61 local_data: None,
62 repository_root_path: "/home/runner/work/codspeed-node/codspeed-node/".into(),
63 },
64 run_part: Some(RunPart {
65 run_id: "7044765741".into(),
66 run_part_id: "benchmarks_3.2.2".into(),
67 job_name: "codspeed".into(),
68 metadata: BTreeMap::from([
69 ("someKey".into(), "someValue".into()),
70 ("anotherKey".into(), "anotherValue".into()),
71 ]),
72 }),
73 };
74
75 let hash = upload_metadata.get_hash();
76 assert_snapshot!(
77 hash,
78 // Caution: when changing this value, we need to ensure that
79 // the related backend snapshot remains the same
80 @"0afc09ee58a610d400aa6b3fbdddf628608ed2e11aed39585a50abe96e1c9284"
81 );
82 assert_json_snapshot!(upload_metadata);
83 }
84
85 #[test]

Callers

nothing calls this directly

Calls 1

get_hashMethod · 0.80

Tested by

no test coverage detected