sagiegurari / ci_info

@@ -184,6 +184,17 @@
Loading
184 184
        branch_name_env: Some("BRANCH_NAME".to_string()),
185 185
    });
186 186
187 +
    config.push(VendorConfig {
188 +
        name: "JenkinsX".to_string(),
189 +
        vendor: Vendor::JenkinsX,
190 +
        ci_env: EnvValue::AllExists(vec![
191 +
            "JX_CHART_REPOSITORY".to_string(),
192 +
            "BUILD_ID".to_string(),
193 +
        ]),
194 +
        pr_env: Some(EnvValue::Exists("PULL_NUMBER".to_string())),
195 +
        branch_name_env: Some("BRANCH_NAME".to_string()),
196 +
    });
197 +
187 198
    config.push(VendorConfig {
188 199
        name: "Magnum CI".to_string(),
189 200
        vendor: Vendor::MagnumCI,

@@ -52,6 +52,8 @@
Loading
52 52
    /// CI vendor
53 53
    Jenkins,
54 54
    /// CI vendor
55 +
    JenkinsX,
56 +
    /// CI vendor
55 57
    MagnumCI,
56 58
    /// CI vendor
57 59
    NetlifyCI,

@@ -596,6 +596,64 @@
Loading
596 596
    assert_eq!(info.branch_name.unwrap(), "mock_branch");
597 597
}
598 598
599 +
#[test]
600 +
fn get_no_pr_jenkinsx() {
601 +
    let info = get_with_env(TestVendorConfig {
602 +
        ci_env: EnvValue::AllExists(vec![
603 +
            "JX_CHART_REPOSITORY".to_string(),
604 +
            "BUILD_ID".to_string(),
605 +
        ]),
606 +
        pr_env: None,
607 +
        branch_name_env: Some("BRANCH_NAME".to_string()),
608 +
    });
609 +
610 +
    assert!(info.ci);
611 +
    assert!(!info.pr.unwrap());
612 +
    assert_eq!(info.vendor.unwrap(), Vendor::JenkinsX);
613 +
    assert_eq!(info.name.unwrap(), "JenkinsX");
614 +
    assert_eq!(info.branch_name.unwrap(), "mock_branch");
615 +
}
616 +
617 +
#[test]
618 +
fn get_partial1_jenkinsx() {
619 +
    let info = get_with_env(TestVendorConfig {
620 +
        ci_env: EnvValue::Exists("JX_CHART_REPOSITORY".to_string()),
621 +
        pr_env: None,
622 +
        branch_name_env: None,
623 +
    });
624 +
625 +
    assert!(!info.ci);
626 +
}
627 +
628 +
#[test]
629 +
fn get_partial2_jenkinsx() {
630 +
    let info = get_with_env(TestVendorConfig {
631 +
        ci_env: EnvValue::Exists("BUILD_ID".to_string()),
632 +
        pr_env: None,
633 +
        branch_name_env: None,
634 +
    });
635 +
636 +
    assert!(!info.ci);
637 +
}
638 +
639 +
#[test]
640 +
fn get_pr_jenkinsx() {
641 +
    let info = get_with_env(TestVendorConfig {
642 +
        ci_env: EnvValue::AllExists(vec![
643 +
            "JX_CHART_REPOSITORY".to_string(),
644 +
            "BUILD_ID".to_string(),
645 +
        ]),
646 +
        pr_env: Some(EnvValue::Exists("PULL_NUMBER".to_string())),
647 +
        branch_name_env: Some("BRANCH_NAME".to_string()),
648 +
    });
649 +
650 +
    assert!(info.ci);
651 +
    assert!(info.pr.unwrap());
652 +
    assert_eq!(info.vendor.unwrap(), Vendor::JenkinsX);
653 +
    assert_eq!(info.name.unwrap(), "JenkinsX");
654 +
    assert_eq!(info.branch_name.unwrap(), "mock_branch");
655 +
}
656 +
599 657
#[test]
600 658
fn get_magnum_ci() {
601 659
    let info = get_with_env(TestVendorConfig {
Files Coverage
src 95.53%
Project Totals (9 files) 95.53%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading