Skip to content

Commit

Permalink
Merge branch 'master' into babolivier/fix-matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmelnikow committed Dec 20, 2018
2 parents fcdbd8e + 2fe61d2 commit 61f7194
Show file tree
Hide file tree
Showing 12 changed files with 525 additions and 52 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,21 @@
<a href="https://circleci.com/gh/badges/daily-tests">
<img src="https://img.shields.io/circleci/project/github/badges/daily-tests.svg?label=service%20tests"
alt="service-test status"></a>
<a href="https://docs.google.com/spreadsheets/d/1cHIUSVaiKrIFw3KIu0yt-EMNlMkIfU5alE7YKZ4PeOE/edit#gid=0">
<img src="https://img.shields.io/github/search/badges/shields/extends%20LegacyService.svg?label=legacy%20services%20needing%20refactor"
alt="legacy services needing refactor"></a>
<a href="https://github.com/search?utf8=%E2%9C%93&q=exampleUrl+repo%3Abadges%2Fshields+path%3A%2Fservices&type=Code&ref=advsearch&l=&l=">
<img src="https://img.shields.io/github/search/badges/shields/exampleUrl.svg?label=`exampleUrl`s%20needing%20refactor"
alt="`exampleUrl`s needing refactor"></a>
<a href="https://coveralls.io/github/badges/shields">
<img src="https://img.shields.io/coveralls/github/badges/shields.svg"
alt="coverage"></a>
<a href="https://lgtm.com/projects/g/badges/shields/alerts/">
<img src="https://img.shields.io/lgtm/alerts/g/badges/shields.svg"
alt="Total alerts"/></a>
<a href="https://github.com/badges/shields/compare/gh-pages...master">
<img src="https://img.shields.io/github/commits-since/badges/shields/gh-pages.svg?label=commits%20to%20be%20deployed"
alt="commits to be deployed"></a>
<a href="https://lgtm.com/projects/g/badges/shields/alerts/">
<img src="https://img.shields.io/lgtm/alerts/g/badges/shields.svg?logo=lgtm&logoWidth=18"
alt="Total alerts"/></a>
<a href="https://discord.gg/HjJCwm5">
<img src="https://img.shields.io/discord/308323056592486420.svg?logo=discord"
alt="chat on Discord"></a>
Expand Down
23 changes: 12 additions & 11 deletions lib/php-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

const { promisify } = require('util')
const request = require('request')
const uniq = require('lodash.uniq')
const { listCompare } = require('./version')
const { omitv } = require('./text-formatters')
const { regularUpdate } = require('./regular-update')
Expand Down Expand Up @@ -193,9 +192,9 @@ function versionReduction(versions, phpReleases) {
}

// versions intersect
versions = uniq(versions)
.sort()
versions = Array.from(new Set(versions))
.filter(n => phpReleases.includes(n))
.sort()

// nothing to reduction
if (versions.length < 2) {
Expand All @@ -222,14 +221,16 @@ function getPhpReleases(githubApiProvider) {
url: '/repos/php/php-src/git/refs/tags',
intervalMillis: 24 * 3600 * 1000, // 1 day
scraper: tags =>
uniq(
tags
// only releases
.filter(
tag => tag.ref.match(/^refs\/tags\/php-\d+\.\d+\.\d+$/) != null
)
// get minor version of release
.map(tag => tag.ref.match(/^refs\/tags\/php-(\d+\.\d+)\.\d+$/)[1])
Array.from(
new Set(
tags
// only releases
.filter(
tag => tag.ref.match(/^refs\/tags\/php-\d+\.\d+\.\d+$/) != null
)
// get minor version of release
.map(tag => tag.ref.match(/^refs\/tags\/php-(\d+\.\d+)\.\d+$/)[1])
)
),
request: (url, options, cb) =>
githubApiProvider.request(request, url, {}, cb),
Expand Down
6 changes: 0 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"lodash.mapkeys": "^4.6.0",
"lodash.throttle": "^4.1.1",
"lodash.times": "^4.3.2",
"lodash.uniq": "~4.5.0",
"moment": "^2.23.0",
"node-env-flag": "^0.1.0",
"path-to-regexp": "^2.4.0",
Expand Down Expand Up @@ -111,7 +110,6 @@
"@babel/preset-env": "^7.1.6",
"@babel/register": "7.0.0",
"@mapbox/react-click-to-select": "^2.2.0",
"almost-equal": "^1.1.0",
"babel-eslint": "^10.0.0",
"babel-plugin-istanbul": "^5.1.0",
"caller": "^1.0.1",
Expand Down
126 changes: 109 additions & 17 deletions services/jira/jira-issue.tester.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use strict'

const t = (module.exports = require('../create-service-tester')())
const jiraTestHelpers = require('./jira-test-helpers')
const { colorScheme } = require('../test-helpers')
const { mockJiraCreds, restore, user, pass } = require('./jira-test-helpers')

t.create('live: unknown issue')
.get('/https/issues.apache.org/jira/notArealIssue-000.json')
Expand All @@ -11,8 +12,8 @@ t.create('live: known issue')
.get('/https/issues.apache.org/jira/kafka-2896.json')
.expectJSON({ name: 'kafka-2896', value: 'Resolved' })

t.create('http endpoint')
.get('/http/issues.apache.org/jira/foo-123.json')
t.create('no status color')
.get('/http/issues.apache.org/jira/foo-123.json?style=_shields_test')
.intercept(nock =>
nock('http://issues.apache.org/jira/rest/api/2/issue')
.get(`/${encodeURIComponent('foo-123')}`)
Expand All @@ -24,64 +25,155 @@ t.create('http endpoint')
},
})
)
.expectJSON({ name: 'foo-123', value: 'pending' })
.expectJSON({
name: 'foo-123',
value: 'pending',
colorB: colorScheme.lightgrey,
})

t.create('endpoint with port and path')
.get('/https/issues.apache.org:8000/jira/bar-345.json')
t.create('green status color')
.get('/https/issues.apache.org:8000/jira/bar-345.json?style=_shields_test')
.intercept(nock =>
nock('https://issues.apache.org:8000/jira/rest/api/2/issue')
.get(`/${encodeURIComponent('bar-345')}`)
.reply(200, {
fields: {
status: {
name: 'done',
statusCategory: {
colorName: 'green',
},
},
},
})
)
.expectJSON({ name: 'bar-345', value: 'done' })
.expectJSON({
name: 'bar-345',
value: 'done',
colorB: colorScheme.green,
})

t.create('endpoint with port and no path')
.get('/https/issues.apache.org:8080/abc-123.json')
t.create('medium-gray status color')
.get('/https/issues.apache.org:8080/abc-123.json?style=_shields_test')
.intercept(nock =>
nock('https://issues.apache.org:8080/rest/api/2/issue')
.get(`/${encodeURIComponent('abc-123')}`)
.reply(200, {
fields: {
status: {
name: 'under review',
statusCategory: {
colorName: 'medium-gray',
},
},
},
})
)
.expectJSON({ name: 'abc-123', value: 'under review' })
.expectJSON({
name: 'abc-123',
value: 'under review',
colorB: colorScheme.lightgrey,
})

t.create('endpoint with no port nor path')
.get('/https/issues.apache.org/test-001.json')
t.create('yellow status color')
.get('/https/issues.apache.org/test-001.json?style=_shields_test')
.intercept(nock =>
nock('https://issues.apache.org/rest/api/2/issue')
.get(`/${encodeURIComponent('test-001')}`)
.reply(200, {
fields: {
status: {
name: 'in progress',
statusCategory: {
colorName: 'yellow',
},
},
},
})
)
.expectJSON({ name: 'test-001', value: 'in progress' })
.expectJSON({
name: 'test-001',
value: 'in progress',
colorB: colorScheme.yellow,
})

t.create('brown status color')
.get('/https/issues.apache.org/zzz-789.json?style=_shields_test')
.intercept(nock =>
nock('https://issues.apache.org/rest/api/2/issue')
.get(`/${encodeURIComponent('zzz-789')}`)
.reply(200, {
fields: {
status: {
name: 'muddy',
statusCategory: {
colorName: 'brown',
},
},
},
})
)
.expectJSON({
name: 'zzz-789',
value: 'muddy',
colorB: colorScheme.orange,
})

t.create('warm-red status color')
.get('/https/issues.apache.org/fire-321.json?style=_shields_test')
.intercept(nock =>
nock('https://issues.apache.org/rest/api/2/issue')
.get(`/${encodeURIComponent('fire-321')}`)
.reply(200, {
fields: {
status: {
name: 'heating up',
statusCategory: {
colorName: 'warm-red',
},
},
},
})
)
.expectJSON({
name: 'fire-321',
value: 'heating up',
colorB: colorScheme.red,
})

t.create('blue-gray status color')
.get('/https/issues.apache.org/sky-775.json?style=_shields_test')
.intercept(nock =>
nock('https://issues.apache.org/rest/api/2/issue')
.get(`/${encodeURIComponent('sky-775')}`)
.reply(200, {
fields: {
status: {
name: 'cloudy',
statusCategory: {
colorName: 'blue-gray',
},
},
},
})
)
.expectJSON({
name: 'sky-775',
value: 'cloudy',
colorB: colorScheme.blue,
})

t.create('with auth')
.before(jiraTestHelpers.mockJiraCreds)
.before(mockJiraCreds)
.get('/https/myprivatejira.com/secure-234.json')
.intercept(nock =>
nock('https://myprivatejira.com/rest/api/2/issue')
.get(`/${encodeURIComponent('secure-234')}`)
// This ensures that the expected credentials from serverSecrets are actually being sent with the HTTP request.
// Without this the request wouldn't match and the test would fail.
.basicAuth({
user: jiraTestHelpers.user,
pass: jiraTestHelpers.pass,
user,
pass,
})
.reply(200, {
fields: {
Expand All @@ -91,5 +183,5 @@ t.create('with auth')
},
})
)
.finally(jiraTestHelpers.restore)
.finally(restore)
.expectJSON({ name: 'secure-234', value: 'in progress' })
Loading

0 comments on commit 61f7194

Please sign in to comment.