Skip to content

Commit d0a0624

Browse files
committed
database/trustpub: Add GitLab variant to TrustpubData enum
1 parent d1b68a4 commit d0a0624

File tree

1 file changed

+28
-1
lines changed
  • crates/crates_io_database/src/models/trustpub

1 file changed

+28
-1
lines changed

crates/crates_io_database/src/models/trustpub/data.rs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ pub enum TrustpubData {
1919
/// SHA of the commit
2020
sha: String,
2121
},
22+
#[serde(rename = "gitlab")]
23+
GitLab {
24+
/// Project path (e.g. "rust-lang/cargo")
25+
project_path: String,
26+
/// Job ID
27+
job_id: String,
28+
/// SHA of the commit
29+
sha: String,
30+
},
2231
}
2332

2433
impl ToSql<Jsonb, Pg> for TrustpubData {
@@ -41,7 +50,7 @@ mod tests {
4150
use insta::assert_json_snapshot;
4251

4352
#[test]
44-
fn test_serialization() {
53+
fn test_github_serialization() {
4554
let data = TrustpubData::GitHub {
4655
repository: "octo-org/octo-repo".to_string(),
4756
run_id: "example-run-id".to_string(),
@@ -57,4 +66,22 @@ mod tests {
5766
}
5867
"#);
5968
}
69+
70+
#[test]
71+
fn test_gitlab_serialization() {
72+
let data = TrustpubData::GitLab {
73+
project_path: "rust-lang/cargo".to_string(),
74+
job_id: "example-job-id".to_string(),
75+
sha: "example-sha".to_string(),
76+
};
77+
78+
assert_json_snapshot!(data, @r#"
79+
{
80+
"provider": "gitlab",
81+
"project_path": "rust-lang/cargo",
82+
"job_id": "example-job-id",
83+
"sha": "example-sha"
84+
}
85+
"#);
86+
}
6087
}

0 commit comments

Comments
 (0)