Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Possible issue with launcher, color formatting, Jenkins, and Sauce Connect #1131

Closed
facultymatt opened this issue Jul 30, 2014 · 5 comments
Closed

Comments

@facultymatt
Copy link

Overview

This issue could be caused by many things but starting here. I am attempting to run protractor on Jenkins with Sauce Connect. I am outputting the sauce id and job name like so:

onComplete: function(runner, log) {
    browser.getSession().then(function(session) {
      console.log("SauceOnDemandSessionID=" + session.getId() + " job-name=Jenkins");
    });
  },

All tests pass, but Jenkins has trouble parsing the test results. The log is below, but specifically the line in question is:

java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 16
\b(Jenkins)\b

Although you can't see it, the Regex parsing is failing because of symbols added for coloring the console output. Specially [0m is causing the error.

Previously this Jenkins job worked fine. You can see the job name being parsed before and after below:

screen_shot_2014-07-30_at_3_14_55_pm_and_screen_shot_2014-07-30_at_3_14_39_pm_and_desktop

It's worth noting the last successful test ran on June 13th. This would have been using protractor version 0.24.1. I pulled a diff for all changes since: 24248d6...master

Possible Cause

I think this line is the culprit. It's new since version 0.24.1 and does appear in the above diff: 24248d6...master#diff-ff5050d3c7f51fca90c4691a4599e852R317

Full Stack For Reference

[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome35 #1 passed
[launcher] firefox29 #2 passed
[launcher] safari6 #3 passed
[launcher] chrome35 #4 passed
[launcher] firefox30 #5 passed
[launcher] internet explorer11 #6 passed
[launcher] internet explorer11 #7 passed
[launcher] internet explorer10 #8 passed

Done, without errors.


Execution Time (2014-07-30 18:59:12 UTC)
protractor:sauce  301.7s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 100%
Total 302s
Shutting down Sauce Connect
Decremented process count for spmatt, now 0
Flushing Sauce Connect Input Stream
Flushing Sauce Connect Error Stream
Closing Sauce Connect process
Sauce Connect stopped for: spmatt
Recording test results
ERROR: Publisher hudson.tasks.junit.JUnitResultArchiver aborted due to exception
java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 16
\b(Jenkins)\b
                 ^
    at java.util.regex.Pattern.error(Pattern.java:1924)
    at java.util.regex.Pattern.escape(Pattern.java:2416)
    at java.util.regex.Pattern.range(Pattern.java:2577)
    at java.util.regex.Pattern.clazz(Pattern.java:2507)
    at java.util.regex.Pattern.sequence(Pattern.java:2030)
    at java.util.regex.Pattern.expr(Pattern.java:1964)
    at java.util.regex.Pattern.group0(Pattern.java:2854)
    at java.util.regex.Pattern.sequence(Pattern.java:2018)
    at java.util.regex.Pattern.expr(Pattern.java:1964)
    at java.util.regex.Pattern.compile(Pattern.java:1665)
    at java.util.regex.Pattern.<init>(Pattern.java:1337)
    at java.util.regex.Pattern.compile(Pattern.java:1022)
    at hudson.plugins.sauce_ondemand.SauceOnDemandReportPublisher.hasTestPassed(SauceOnDemandReportPublisher.java:167)
    at hudson.plugins.sauce_ondemand.SauceOnDemandReportPublisher.processBuildOutput(SauceOnDemandReportPublisher.java:128)
    at hudson.plugins.sauce_ondemand.SauceOnDemandReportPublisher.getTestData(SauceOnDemandReportPublisher.java:89)
    at hudson.plugins.sauce_ondemand.SauceOnDemandReportPublisher.getTestData(SauceOnDemandReportPublisher.java:55)
    at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:147)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:772)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:736)
    at hudson.model.Build$BuildExecution.post2(Build.java:183)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:685)
    at hudson.model.Run.execute(Run.java:1757)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:234)
Warning: you have no plugins providing access control for builds, so falling back to legacy behavior of permitting any downstream builds to be triggered
@juliemr
Copy link
Member

juliemr commented Aug 1, 2014

I think you're right about the culprit line. The launcher doesn't respect turning off colors in the reporter - it might be difficult to do this since how to turn off colors depends on which framework is being used.

I'm curious why this actually crashes things, as opposed to just outputting some ugly characters in your logs. Looks like a special reporter is blowing up?

@facultymatt
Copy link
Author

Good question @juliemr, I'm using a Jenkins module that parses jUnit tests results into Jenkins job data. The module uses regex to parse the xml. The extra characters cause the java.util.regex.Pattern.error shown above.

To clarify, the protractor tests run fine. The test fails because Jenkins chokes parsing the resulting xml. Maybe this is a bug for jasmine junit reporter?

@juliemr
Copy link
Member

juliemr commented Aug 4, 2014

@hankduan can you take a look at this and see if we can turn off the color reset in some intelligent way if the reporter is not using colors?

hankduan added a commit to hankduan/protractor that referenced this issue Aug 5, 2014
@hankduan
Copy link
Contributor

hankduan commented Aug 5, 2014

@facultymatt Can you verify this fix works for your issue?

@juliemr
Copy link
Member

juliemr commented Sep 4, 2014

This was fixed a while ago - I'm closing this issue. Please open a new one if problems persist.

@juliemr juliemr closed this as completed Sep 4, 2014
@hankduan hankduan removed their assignment Nov 4, 2015
bodyduardU pushed a commit to bodyduardU/protractor that referenced this issue Dec 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants