Mao
Mao

Reputation: 1

How to get Deployment Risk (Bluemix Devops Insights) Gate pass?

I setup bluemix devops pipeline with DevOps insights Gate node included. Unit test result (mocha format) and coverage result (istanbul format) have been uploaded in test jobs (using grunt-idra3 npm plugin as same as the tutorial did ⇒github url).

However, my gate job is still failed, though unit test is showing 100% pass.

Much appreciated if someone can help me.

Snapshot of DevOps Insight⇒ Snapshot of DevOps Insight

All unit test passed, but still "decision for Unit Test" is red failedenter image description here

Detail of policy & rules : policy "Standard Mocha Test Policy"

Rule-1: Functional verification test, Rule type: Functional verification test, Results file format: xUnit, Percent Passes: 100%

Rule-2: Istanbul Coverage Rule, Rule type: Code Coverage, Result file format: istanbul, Minimum code coverage required: 80%

Rule-3: Mocha Unit Test Rule, Rule type: Unit Test, Results file format: xUnit, Percent Passes: 100%

Upvotes: 0

Views: 139

Answers (2)

Mao
Mao

Reputation: 1

After spending almost 3 weeks on this, finally I get DevOps Gate Job all green. Thanks @Vijay Aggarwal, and everyone else who helped on this issue.

Here is actually what happened and how it is solved finally.


[Root Cause]

  1. DevOps Insight is "environment sensitive" in decision phase (not in result display though). In my case, I put "STAGING" into "Environment Name" property of Gate Job, thus DevOps Insight does not properly evaluate all the test result I uploaded in both Staging phase and Build phase.
  2. DevOps Rules are "Result Format Sensitive" too, so people must be careful in choosing "reporter" for Mocha or Istanbul. In my case, I defined the gulp file as follows, but incorrectly set result type to "mocha" in Policy Rule definition.

    
     gulp.task("test", ["pre-test"], function() {
     return gulp.src(["./test/**/*.js"], {read: false})
       .pipe(mocha({
       reporter: "mocha-junit-reporter",
       reporterOptions: {
       mochaFile: './testResult/testResult-summary.xml'
       }
     }));
    

[How it is solved]

  1. Keep "Environment Name" field empty for Gate Job.
  2. In Rule definition page (inside DevOps Policy page), make sure the format type of unit test result is "xUnit".

Screenshot when DevOps Gate is finally passed

Upvotes: 0

Vijay Aggarwal
Vijay Aggarwal

Reputation: 11

There seems to be a mismatch between the format specified in Rule (xUnit) and the format of the actual test results (Mocha).

Please update the rule to select "Mocha" format for Unit Tests. Then rerun the gate.

Upvotes: 1

Related Questions