Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2019-12-19 18:07:48 +00:00
parent f92a53a216
commit b5571e6e22
24 changed files with 487 additions and 204 deletions

View File

@ -23,7 +23,7 @@ build-qa-image:
stage: prepare stage: prepare
script: script:
- '[[ ! -d "ee/" ]] || export GITLAB_EDITION="ee"' - '[[ ! -d "ee/" ]] || export GITLAB_EDITION="ee"'
- export QA_MASTER_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab/gitlab-${GITLAB_EDITION}-qa:master" - export QA_MASTER_IMAGE="${CI_REGISTRY}/gitlab-org/gitlab/gitlab/gitlab-${GITLAB_EDITION}-qa:master"
- export QA_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab/gitlab-${GITLAB_EDITION}-qa:${CI_COMMIT_REF_SLUG}" - export QA_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab/gitlab-${GITLAB_EDITION}-qa:${CI_COMMIT_REF_SLUG}"
- time docker pull "${QA_MASTER_IMAGE}" - time docker pull "${QA_MASTER_IMAGE}"
- time docker build --cache-from "${QA_MASTER_IMAGE}" --tag ${QA_IMAGE} --file ./qa/Dockerfile ./ - time docker build --cache-from "${QA_MASTER_IMAGE}" --tag ${QA_IMAGE} --file ./qa/Dockerfile ./

View File

@ -1 +1 @@
8.17.0 8.18.0

View File

@ -2,13 +2,13 @@
import $ from 'jquery'; import $ from 'jquery';
import _ from 'underscore'; import _ from 'underscore';
import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import { __ } from './locale'; import { __ } from './locale';
import { updateTooltipTitle } from './lib/utils/common_utils'; import { updateTooltipTitle } from './lib/utils/common_utils';
import { isInVueNoteablePage } from './lib/utils/dom_utils'; import { isInVueNoteablePage } from './lib/utils/dom_utils';
import flash from './flash'; import flash from './flash';
import axios from './lib/utils/axios_utils'; import axios from './lib/utils/axios_utils';
import bp from './breakpoints';
const animationEndEventString = 'animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd'; const animationEndEventString = 'animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd';
const transitionEndEventString = 'transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'; const transitionEndEventString = 'transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd';

View File

@ -2,7 +2,7 @@
class Projects::Environments::SampleMetricsController < Projects::ApplicationController class Projects::Environments::SampleMetricsController < Projects::ApplicationController
def query def query
result = Metrics::SampleMetricsService.new(params[:identifier]).query result = Metrics::SampleMetricsService.new(params[:identifier], range_start: params[:start], range_end: params[:end]).query
if result if result
render json: { "status": "success", "data": { "resultType": "matrix", "result": result } } render json: { "status": "success", "data": { "resultType": "matrix", "result": result } }

View File

@ -15,11 +15,11 @@ module Taskable
INCOMPLETE_PATTERN = /(\[[\s]\])/.freeze INCOMPLETE_PATTERN = /(\[[\s]\])/.freeze
ITEM_PATTERN = %r{ ITEM_PATTERN = %r{
^ ^
(?:(?:>\s{0,4})*) # optional blockquote characters (?:(?:>\s{0,4})*) # optional blockquote characters
\s*(?:[-+*]|(?:\d+\.)) # list prefix required - task item has to be always in a list (?:\s*(?:[-+*]|(?:\d+\.)))+ # list prefix (one or more) required - task item has to be always in a list
\s+ # whitespace prefix has to be always presented for a list item \s+ # whitespace prefix has to be always presented for a list item
(\[\s\]|\[[xX]\]) # checkbox (\[\s\]|\[[xX]\]) # checkbox
(\s.+) # followed by whitespace and some text. (\s.+) # followed by whitespace and some text.
}x.freeze }x.freeze
def self.get_tasks(content) def self.get_tasks(content)

View File

@ -4,16 +4,17 @@ module Metrics
class SampleMetricsService class SampleMetricsService
DIRECTORY = "sample_metrics" DIRECTORY = "sample_metrics"
attr_reader :identifier attr_reader :identifier, :range_minutes
def initialize(identifier) def initialize(identifier, range_start:, range_end:)
@identifier = identifier @identifier = identifier
@range_minutes = convert_range_minutes(range_start, range_end)
end end
def query def query
return unless identifier && File.exist?(file_location) return unless identifier && File.exist?(file_location)
YAML.load_file(File.expand_path(file_location, __dir__)) query_interval
end end
private private
@ -22,5 +23,14 @@ module Metrics
sanitized_string = identifier.gsub(/[^0-9A-Za-z_]/, '') sanitized_string = identifier.gsub(/[^0-9A-Za-z_]/, '')
File.join(Rails.root, DIRECTORY, "#{sanitized_string}.yml") File.join(Rails.root, DIRECTORY, "#{sanitized_string}.yml")
end end
def query_interval
result = YAML.load_file(File.expand_path(file_location, __dir__))
result[range_minutes]
end
def convert_range_minutes(range_start, range_end)
((range_end.to_time - range_start.to_time) / 1.minute).to_i
end
end end
end end

View File

@ -0,0 +1,5 @@
---
title: Properly check a task embedded in a list with no text
merge_request: 21947
author:
type: fixed

View File

@ -0,0 +1,5 @@
---
title: Add full text search to pod logs
merge_request: 21656
author:
type: added

View File

@ -0,0 +1,5 @@
---
title: Rename common template jobs in sast and ds
merge_request: 22084
author:
type: fixed

View File

@ -0,0 +1,5 @@
---
title: Generate Prometheus sample metrics over pre-set intervals
merge_request: 22066
author:
type: added

View File

@ -0,0 +1,5 @@
---
title: Update Workhorse to v8.18.0
merge_request: 22091
author:
type: other

View File

@ -58,6 +58,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get :trace, defaults: { format: 'json' } get :trace, defaults: { format: 'json' }
get :raw get :raw
get :terminal get :terminal
# This route is also defined in gitlab-workhorse. Make sure to update accordingly.
get '/terminal.ws/authorize', to: 'jobs#terminal_websocket_authorize', format: false get '/terminal.ws/authorize', to: 'jobs#terminal_websocket_authorize', format: false
end end
@ -235,6 +237,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get :metrics get :metrics
get :additional_metrics get :additional_metrics
get :metrics_dashboard get :metrics_dashboard
# This route is also defined in gitlab-workhorse. Make sure to update accordingly.
get '/terminal.ws/authorize', to: 'environments#terminal_websocket_authorize', format: false get '/terminal.ws/authorize', to: 'environments#terminal_websocket_authorize', format: false
get '/prometheus/api/v1/*proxy_path', to: 'environments/prometheus_api#proxy', as: :prometheus_api get '/prometheus/api/v1/*proxy_path', to: 'environments/prometheus_api#proxy', as: :prometheus_api

View File

@ -78,13 +78,27 @@ projects:
All Go projects should include these GitLab CI/CD jobs: All Go projects should include these GitLab CI/CD jobs:
```yaml ```yaml
go lint: lint:
image: golang:1.11 image: registry.gitlab.com/gitlab-org/gitlab-build-images:golangci-lint-alpine
stage: test
script: script:
- go get -u golang.org/x/lint/golint # Use default .golangci.yml file from the image if one is not present in the project root.
- golint -set_exit_status $(go list ./... | grep -v "vendor/") - '[ -e .golangci.yml ] || cp /golangci/.golangci.yml .'
# Write the code coverage report to gl-code-quality-report.json
# and print linting issues to stdout in the format: path/to/file:line description
- golangci-lint run --out-format code-climate | tee gl-code-quality-report.json | jq -r '.[] | "\(.location.path):\(.location.lines.begin) \(.description)"'
artifacts:
reports:
codequality: gl-code-quality-report.json
paths:
- gl-code-quality-report.json
allow_failure: true
``` ```
Including a `.golangci.yml` in the root directory of the project allows for
configuration of `golangci-lint`. All options for `golangci-lint` are listed in
this [example](https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml).
Once [recursive includes](https://gitlab.com/gitlab-org/gitlab-foss/issues/56836) Once [recursive includes](https://gitlab.com/gitlab-org/gitlab-foss/issues/56836)
become available, you will be able to share job templates like this become available, you will be able to share job templates like this
[analyzer](https://gitlab.com/gitlab-org/security-products/ci-templates/raw/master/includes-dev/analyzer.yml). [analyzer](https://gitlab.com/gitlab-org/security-products/ci-templates/raw/master/includes-dev/analyzer.yml).

View File

@ -1,11 +1,11 @@
# Generate Sample Prometheus Data # Generate Sample Prometheus Data
This command will run Prometheus queries for each of the metrics of a specific environment This command will run Prometheus queries for each of the metrics of a specific environment
for a default time interval of 7 days ago to now. The results of each of query are stored for a series of time intervals: 30 minutes, 3 hours, 8 hours, 24 hours, 72 hours, and 7 days
under a `sample_metrics` directory as a yaml file named by the metric's `identifier`. to now. The results of each of query are stored under a `sample_metrics` directory as a yaml
When the environmental variable `USE_SAMPLE_METRICS` is set, the Prometheus API query is file named by the metric's `identifier`. When the environmental variable `USE_SAMPLE_METRICS`
re-routed to `Projects::Environments::SampleMetricsController` which loads the appropriate is set, the Prometheus API query is re-routed to `Projects::Environments::SampleMetricsController`
data set if it is present within the `sample_metrics` directory. which loads the appropriate data set if it is present within the `sample_metrics` directory.
- This command requires an id from an Environment with an available Prometheus installation. - This command requires an id from an Environment with an available Prometheus installation.

View File

@ -72,7 +72,7 @@ dependency_scanning:
- $DEPENDENCY_SCANNING_DISABLED - $DEPENDENCY_SCANNING_DISABLED
- $DS_DISABLE_DIND == 'true' - $DS_DISABLE_DIND == 'true'
.analyzer: .ds-analyzer:
extends: dependency_scanning extends: dependency_scanning
services: [] services: []
except: except:
@ -82,7 +82,7 @@ dependency_scanning:
- /analyzer run - /analyzer run
gemnasium-dependency_scanning: gemnasium-dependency_scanning:
extends: .analyzer extends: .ds-analyzer
image: image:
name: "$DS_ANALYZER_IMAGE_PREFIX/gemnasium:$DS_MAJOR_VERSION" name: "$DS_ANALYZER_IMAGE_PREFIX/gemnasium:$DS_MAJOR_VERSION"
only: only:
@ -92,7 +92,7 @@ gemnasium-dependency_scanning:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /ruby|javascript|php/ $CI_PROJECT_REPOSITORY_LANGUAGES =~ /ruby|javascript|php/
gemnasium-maven-dependency_scanning: gemnasium-maven-dependency_scanning:
extends: .analyzer extends: .ds-analyzer
image: image:
name: "$DS_ANALYZER_IMAGE_PREFIX/gemnasium-maven:$DS_MAJOR_VERSION" name: "$DS_ANALYZER_IMAGE_PREFIX/gemnasium-maven:$DS_MAJOR_VERSION"
only: only:
@ -102,7 +102,7 @@ gemnasium-maven-dependency_scanning:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /\bjava\b/ $CI_PROJECT_REPOSITORY_LANGUAGES =~ /\bjava\b/
gemnasium-python-dependency_scanning: gemnasium-python-dependency_scanning:
extends: .analyzer extends: .ds-analyzer
image: image:
name: "$DS_ANALYZER_IMAGE_PREFIX/gemnasium-python:$DS_MAJOR_VERSION" name: "$DS_ANALYZER_IMAGE_PREFIX/gemnasium-python:$DS_MAJOR_VERSION"
only: only:
@ -112,7 +112,7 @@ gemnasium-python-dependency_scanning:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /python/ $CI_PROJECT_REPOSITORY_LANGUAGES =~ /python/
bundler-audit-dependency_scanning: bundler-audit-dependency_scanning:
extends: .analyzer extends: .ds-analyzer
image: image:
name: "$DS_ANALYZER_IMAGE_PREFIX/bundler-audit:$DS_MAJOR_VERSION" name: "$DS_ANALYZER_IMAGE_PREFIX/bundler-audit:$DS_MAJOR_VERSION"
only: only:
@ -122,7 +122,7 @@ bundler-audit-dependency_scanning:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /ruby/ $CI_PROJECT_REPOSITORY_LANGUAGES =~ /ruby/
retire-js-dependency_scanning: retire-js-dependency_scanning:
extends: .analyzer extends: .ds-analyzer
image: image:
name: "$DS_ANALYZER_IMAGE_PREFIX/retire.js:$DS_MAJOR_VERSION" name: "$DS_ANALYZER_IMAGE_PREFIX/retire.js:$DS_MAJOR_VERSION"
only: only:

View File

@ -50,7 +50,7 @@ sast:
- $SAST_DISABLED - $SAST_DISABLED
- $SAST_DISABLE_DIND == 'true' - $SAST_DISABLE_DIND == 'true'
.analyzer: .sast-analyzer:
extends: sast extends: sast
services: [] services: []
except: except:
@ -60,7 +60,7 @@ sast:
- /analyzer run - /analyzer run
bandit-sast: bandit-sast:
extends: .analyzer extends: .sast-analyzer
image: image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/bandit:$SAST_ANALYZER_IMAGE_TAG" name: "$SAST_ANALYZER_IMAGE_PREFIX/bandit:$SAST_ANALYZER_IMAGE_TAG"
only: only:
@ -70,7 +70,7 @@ bandit-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /python/ $CI_PROJECT_REPOSITORY_LANGUAGES =~ /python/
brakeman-sast: brakeman-sast:
extends: .analyzer extends: .sast-analyzer
image: image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/brakeman:$SAST_ANALYZER_IMAGE_TAG" name: "$SAST_ANALYZER_IMAGE_PREFIX/brakeman:$SAST_ANALYZER_IMAGE_TAG"
only: only:
@ -80,7 +80,7 @@ brakeman-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /ruby/ $CI_PROJECT_REPOSITORY_LANGUAGES =~ /ruby/
eslint-sast: eslint-sast:
extends: .analyzer extends: .sast-analyzer
image: image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/eslint:$SAST_ANALYZER_IMAGE_TAG" name: "$SAST_ANALYZER_IMAGE_PREFIX/eslint:$SAST_ANALYZER_IMAGE_TAG"
only: only:
@ -90,7 +90,7 @@ eslint-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /javascript/ $CI_PROJECT_REPOSITORY_LANGUAGES =~ /javascript/
flawfinder-sast: flawfinder-sast:
extends: .analyzer extends: .sast-analyzer
image: image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/flawfinder:$SAST_ANALYZER_IMAGE_TAG" name: "$SAST_ANALYZER_IMAGE_PREFIX/flawfinder:$SAST_ANALYZER_IMAGE_TAG"
only: only:
@ -100,7 +100,7 @@ flawfinder-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /\b(c\+\+|c)\b/ $CI_PROJECT_REPOSITORY_LANGUAGES =~ /\b(c\+\+|c)\b/
kubesec-sast: kubesec-sast:
extends: .analyzer extends: .sast-analyzer
image: image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/kubesec:$SAST_ANALYZER_IMAGE_TAG" name: "$SAST_ANALYZER_IMAGE_PREFIX/kubesec:$SAST_ANALYZER_IMAGE_TAG"
only: only:
@ -110,7 +110,7 @@ kubesec-sast:
$SCAN_KUBERNETES_MANIFESTS == 'true' $SCAN_KUBERNETES_MANIFESTS == 'true'
gosec-sast: gosec-sast:
extends: .analyzer extends: .sast-analyzer
image: image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/gosec:$SAST_ANALYZER_IMAGE_TAG" name: "$SAST_ANALYZER_IMAGE_PREFIX/gosec:$SAST_ANALYZER_IMAGE_TAG"
only: only:
@ -120,7 +120,7 @@ gosec-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /\bgo\b/ $CI_PROJECT_REPOSITORY_LANGUAGES =~ /\bgo\b/
nodejs-scan-sast: nodejs-scan-sast:
extends: .analyzer extends: .sast-analyzer
image: image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/nodejs-scan:$SAST_ANALYZER_IMAGE_TAG" name: "$SAST_ANALYZER_IMAGE_PREFIX/nodejs-scan:$SAST_ANALYZER_IMAGE_TAG"
only: only:
@ -130,7 +130,7 @@ nodejs-scan-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /javascript/ $CI_PROJECT_REPOSITORY_LANGUAGES =~ /javascript/
phpcs-security-audit-sast: phpcs-security-audit-sast:
extends: .analyzer extends: .sast-analyzer
image: image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/phpcs-security-audit:$SAST_ANALYZER_IMAGE_TAG" name: "$SAST_ANALYZER_IMAGE_PREFIX/phpcs-security-audit:$SAST_ANALYZER_IMAGE_TAG"
only: only:
@ -140,7 +140,7 @@ phpcs-security-audit-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /php/ $CI_PROJECT_REPOSITORY_LANGUAGES =~ /php/
pmd-apex-sast: pmd-apex-sast:
extends: .analyzer extends: .sast-analyzer
image: image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/pmd-apex:$SAST_ANALYZER_IMAGE_TAG" name: "$SAST_ANALYZER_IMAGE_PREFIX/pmd-apex:$SAST_ANALYZER_IMAGE_TAG"
only: only:
@ -150,7 +150,7 @@ pmd-apex-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /apex/ $CI_PROJECT_REPOSITORY_LANGUAGES =~ /apex/
secrets-sast: secrets-sast:
extends: .analyzer extends: .sast-analyzer
image: image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/secrets:$SAST_ANALYZER_IMAGE_TAG" name: "$SAST_ANALYZER_IMAGE_PREFIX/secrets:$SAST_ANALYZER_IMAGE_TAG"
only: only:
@ -159,7 +159,7 @@ secrets-sast:
$SAST_DEFAULT_ANALYZERS =~ /secrets/ $SAST_DEFAULT_ANALYZERS =~ /secrets/
security-code-scan-sast: security-code-scan-sast:
extends: .analyzer extends: .sast-analyzer
image: image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/security-code-scan:$SAST_ANALYZER_IMAGE_TAG" name: "$SAST_ANALYZER_IMAGE_PREFIX/security-code-scan:$SAST_ANALYZER_IMAGE_TAG"
only: only:
@ -169,7 +169,7 @@ security-code-scan-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /\b(c\#|visual basic\b)/ $CI_PROJECT_REPOSITORY_LANGUAGES =~ /\b(c\#|visual basic\b)/
sobelow-sast: sobelow-sast:
extends: .analyzer extends: .sast-analyzer
image: image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/sobelow:$SAST_ANALYZER_IMAGE_TAG" name: "$SAST_ANALYZER_IMAGE_PREFIX/sobelow:$SAST_ANALYZER_IMAGE_TAG"
only: only:
@ -179,7 +179,7 @@ sobelow-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /elixir/ $CI_PROJECT_REPOSITORY_LANGUAGES =~ /elixir/
spotbugs-sast: spotbugs-sast:
extends: .analyzer extends: .sast-analyzer
image: image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/spotbugs:$SAST_ANALYZER_IMAGE_TAG" name: "$SAST_ANALYZER_IMAGE_PREFIX/spotbugs:$SAST_ANALYZER_IMAGE_TAG"
only: only:
@ -189,7 +189,7 @@ spotbugs-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /java\b/ $CI_PROJECT_REPOSITORY_LANGUAGES =~ /java\b/
tslint-sast: tslint-sast:
extends: .analyzer extends: .sast-analyzer
image: image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/tslint:$SAST_ANALYZER_IMAGE_TAG" name: "$SAST_ANALYZER_IMAGE_PREFIX/tslint:$SAST_ANALYZER_IMAGE_TAG"
only: only:

View File

@ -8,12 +8,17 @@ namespace :gitlab do
sample_metrics_directory_name = Metrics::SampleMetricsService::DIRECTORY sample_metrics_directory_name = Metrics::SampleMetricsService::DIRECTORY
FileUtils.mkdir_p(sample_metrics_directory_name) FileUtils.mkdir_p(sample_metrics_directory_name)
sample_metrics_intervals = [30.minutes, 180.minutes, 8.hours, 24.hours, 72.hours, 7.days]
metrics.each do |metric| metrics.each do |metric|
query = metric.query % query_variables query = metric.query % query_variables
result = environment.prometheus_adapter.prometheus_client.query_range(query, start: 7.days.ago)
next unless metric.identifier next unless metric.identifier
result = sample_metrics_intervals.each_with_object({}) do |interval, memo|
memo[interval.to_i / 60] = environment.prometheus_adapter.prometheus_client.query_range(query, start: interval.ago)
end
File.write("#{sample_metrics_directory_name}/#{metric.identifier}.yml", result.to_yaml) File.write("#{sample_metrics_directory_name}/#{metric.identifier}.yml", result.to_yaml)
end end
end end

View File

@ -6896,6 +6896,9 @@ msgstr ""
msgid "Environments|Rollback environment %{name}?" msgid "Environments|Rollback environment %{name}?"
msgstr "" msgstr ""
msgid "Environments|Search"
msgstr ""
msgid "Environments|Show all" msgid "Environments|Show all"
msgstr "" msgstr ""

View File

@ -24,12 +24,8 @@ module QA
project = Resource::Project.fabricate_via_api! do |resource| project = Resource::Project.fabricate_via_api! do |resource|
resource.name = 'xss-test-for-mentions-project' resource.name = 'xss-test-for-mentions-project'
end end
project.visit!
Page::Project::Show.perform(&:go_to_members_settings) Flow::Project.add_member(project: project, username: user.username)
Page::Project::Settings::Members.perform do |members|
members.add_member(user.username)
end
issue = Resource::Issue.fabricate_via_api! do |issue| issue = Resource::Issue.fabricate_via_api! do |issue|
issue.title = 'issue title' issue.title = 'issue title'
@ -42,7 +38,7 @@ module QA
show.comment("cc-ing you here @#{user.username}") show.comment("cc-ing you here @#{user.username}")
expect do expect do
expect(show).to have_content("cc-ing you here") expect(show).to have_comment("cc-ing you here")
end.not_to raise_error # Selenium::WebDriver::Error::UnhandledAlertError end.not_to raise_error # Selenium::WebDriver::Error::UnhandledAlertError
end end
end end

View File

@ -58,7 +58,9 @@ describe Projects::Environments::SampleMetricsController do
id: environment.id.to_s, id: environment.id.to_s,
namespace_id: project.namespace.full_path, namespace_id: project.namespace.full_path,
project_id: project.name, project_id: project.name,
identifier: 'sample_metric_query_result' identifier: 'sample_metric_query_result',
start: '2019-12-02T23:31:45.000Z',
end: '2019-12-03T00:01:45.000Z'
}.merge(params) }.merge(params)
end end
end end

View File

@ -1,151 +1,332 @@
--- ---
30:
- metric: {} - metric: {}
values: values:
- - 1573560714.209 - - 1576719533.248
- '0.02361297607421875' - '0.0006172414678571515'
- - 1573560774.209 - - 1576719593.248
- '0.02361297607421875' - '0.0006189408976190352'
- - 1573560834.209 - - 1576719653.248
- '0.02362823486328125' - '0.0006182154988094691'
- - 1573560894.209 - - 1576719713.248
- '0.02361297607421875' - '0.0006194998404763076'
- - 1573560954.209 - - 1576719773.248
- '0.02385711669921875' - '0.0006194687678569856'
- - 1573561014.209 - - 1576719833.248
- '0.02361297607421875' - '0.0006171203535713976'
- - 1573561074.209 - - 1576719893.248
- '0.02361297607421875' - '0.0006244061773808577'
- - 1573561134.209 - - 1576719953.248
- '0.02362060546875' - '0.0006170288511561634'
- - 1573561194.209 - - 1576720013.248
- '0.02362060546875' - '0.0006243750281248557'
- - 1573561254.209 - - 1576720073.248
- '0.02362060546875' - '0.0006152456571427256'
- - 1573561314.209 - - 1576720133.248
- '0.02362060546875' - '0.0006215679095237733'
- - 1573561374.209 - - 1576720193.248
- '0.023624420166015625' - '0.0006218523571429083'
- - 1573561434.209 - - 1576720253.248
- '0.023651123046875' - '0.0006200312440475792'
- - 1573561494.209 - - 1576720313.248
- '0.02362060546875' - '0.0006214166202382676'
- - 1573561554.209 - - 1576720373.248
- '0.0236358642578125' - '0.0006152486976191084'
- - 1573561614.209 - - 1576720433.248
- '0.02362060546875' - '0.0006136406750000235'
- - 1573561674.209 - - 1576720493.248
- '0.02362060546875' - '0.0006135999154761997'
- - 1573561734.209 - - 1576720553.248
- '0.02362060546875' - '0.0006126559190475756'
- - 1573561794.209 - - 1576720613.248
- '0.02362060546875' - '0.0006153160392857769'
- - 1573561854.209 - - 1576720673.248
- '0.02362060546875' - '0.0006146447178572262'
- - 1573561914.209 - - 1576720733.248
- '0.023651123046875' - '0.0006146970476189988'
- - 1573561974.209 - - 1576720793.248
- '0.02362060546875' - '0.0006219259035715042'
- - 1573562034.209 - - 1576720853.248
- '0.02362060546875' - '0.0006111198750001481'
- - 1573562094.209 - - 1576720913.248
- '0.02362060546875' - '0.0006169941035715337'
- - 1573562154.209 - - 1576720973.248
- '0.02362060546875' - '0.0006102626761905379'
- - 1573562214.209 - - 1576721033.248
- '0.023624420166015625' - '0.0006163839964285346'
- - 1573562274.209 180:
- '0.02362060546875' - metric: {}
- - 1573562334.209 values:
- '0.023868560791015625' - - 1576719533.248
- - 1573562394.209 - '0.0006172414678571515'
- '0.02374267578125' - - 1576719593.248
- - 1573562454.209 - '0.0006189408976190352'
- '0.02362060546875' - - 1576719653.248
- - 1573562514.209 - '0.0006182154988094691'
- '0.02362060546875' - - 1576719713.248
- - 1573562574.209 - '0.0006194998404763076'
- '0.02362060546875' - - 1576719773.248
- - 1573562634.209 - '0.0006194687678569856'
- '0.02362060546875' - - 1576719833.248
- - 1573562694.209 - '0.0006171203535713976'
- '0.023639678955078125' - - 1576719893.248
- - 1573562754.209 - '0.0006244061773808577'
- '0.0236358642578125' - - 1576719953.248
- - 1573562814.209 - '0.0006170288511561634'
- '0.02362060546875' - - 1576720013.248
- - 1573562874.209 - '0.0006243750281248557'
- '0.0236358642578125' - - 1576720073.248
- - 1573562934.209 - '0.0006152456571427256'
- '0.023651123046875' - - 1576720133.248
- - 1573562994.209 - '0.0006215679095237733'
- '0.02362060546875' - - 1576720193.248
- - 1573563054.209 - '0.0006218523571429083'
- '0.023624420166015625' - - 1576720253.248
- - 1573563114.209 - '0.0006200312440475792'
- '0.02362060546875' - - 1576720313.248
- - 1573563174.209 - '0.0006214166202382676'
- '0.02362060546875' - - 1576720373.248
- - 1573563234.209 - '0.0006152486976191084'
- '0.02362060546875' - - 1576720433.248
- - 1573563294.209 - '0.0006136406750000235'
- '0.02362060546875' - - 1576720493.248
- - 1573563354.209 - '0.0006135999154761997'
- '0.02362060546875' - - 1576720553.248
- - 1573563414.209 - '0.0006126559190475756'
- '0.023651123046875' - - 1576720613.248
- - 1573563474.209 - '0.0006153160392857769'
- '0.023651123046875' - - 1576720673.248
- - 1573563534.209 - '0.0006146447178572262'
- '0.023651123046875' - - 1576720733.248
- - 1573563594.209 - '0.0006146970476189988'
- '0.023773193359375' - - 1576720793.248
- - 1573563654.209 - '0.0006219259035715042'
- '0.023681640625' - - 1576720853.248
- - 1573563714.209 - '0.0006111198750001481'
- '0.023895263671875' - - 1576720913.248
- - 1573563774.209 - '0.0006169941035715337'
- '0.023651123046875' - - 1576720973.248
- - 1573563834.209 - '0.0006102626761905379'
- '0.023651123046875' - - 1576721033.248
- - 1573563894.209 - '0.0006163839964285346'
- '0.023651123046875' 480:
- - 1573563954.209 - metric: {}
- '0.0236663818359375' values:
- - 1573564014.209 - - 1576719533.248
- '0.023651123046875' - '0.0006172414678571515'
- - 1573564074.209 - - 1576719593.248
- '0.023681640625' - '0.0006189408976190352'
- - 1573564134.209 - - 1576719653.248
- '0.0236663818359375' - '0.0006182154988094691'
- - 1573564194.209 - - 1576719713.248
- '0.0236663818359375' - '0.0006194998404763076'
- - 1573564254.209 - - 1576719773.248
- '0.023651123046875' - '0.0006194687678569856'
- - 1573564314.209 - - 1576719833.248
- '0.023651123046875' - '0.0006171203535713976'
- - 1573564374.209 - - 1576719893.248
- '0.023651123046875' - '0.0006244061773808577'
- - 1573564434.209 - - 1576719953.248
- '0.023773193359375' - '0.0006170288511561634'
- - 1573564494.209 - - 1576720013.248
- '0.023651123046875' - '0.0006243750281248557'
- - 1573564554.209 - - 1576720073.248
- '0.023681640625' - '0.0006152456571427256'
- - 1573564614.209 - - 1576720133.248
- '0.023773193359375' - '0.0006215679095237733'
- - 1573564674.209 - - 1576720193.248
- '0.023651123046875' - '0.0006218523571429083'
- - 1573564734.209 - - 1576720253.248
- '0.023651123046875' - '0.0006200312440475792'
- - 1573564794.209 - - 1576720313.248
- '0.023651123046875' - '0.0006214166202382676'
- - 1573564854.209 - - 1576720373.248
- '0.023651123046875' - '0.0006152486976191084'
- - 1573564914.209 - - 1576720433.248
- '0.023651123046875' - '0.0006136406750000235'
- - 1573564974.209 - - 1576720493.248
- '0.023651123046875' - '0.0006135999154761997'
- - 1573565034.209 - - 1576720553.248
- '0.023651123046875' - '0.0006126559190475756'
- - 1573565094.209 - - 1576720613.248
- '0.023895263671875' - '0.0006153160392857769'
- - 1576720673.248
- '0.0006146447178572262'
- - 1576720733.248
- '0.0006146970476189988'
- - 1576720793.248
- '0.0006219259035715042'
- - 1576720853.248
- '0.0006111198750001481'
- - 1576720913.248
- '0.0006169941035715337'
- - 1576720973.248
- '0.0006102626761905379'
- - 1576721033.248
- '0.0006163839964285346'
1440:
- metric: {}
values:
- - 1576719533.248
- '0.0006172414678571515'
- - 1576719593.248
- '0.0006189408976190352'
- - 1576719653.248
- '0.0006182154988094691'
- - 1576719713.248
- '0.0006194998404763076'
- - 1576719773.248
- '0.0006194687678569856'
- - 1576719833.248
- '0.0006171203535713976'
- - 1576719893.248
- '0.0006244061773808577'
- - 1576719953.248
- '0.0006170288511561634'
- - 1576720013.248
- '0.0006243750281248557'
- - 1576720073.248
- '0.0006152456571427256'
- - 1576720133.248
- '0.0006215679095237733'
- - 1576720193.248
- '0.0006218523571429083'
- - 1576720253.248
- '0.0006200312440475792'
- - 1576720313.248
- '0.0006214166202382676'
- - 1576720373.248
- '0.0006152486976191084'
- - 1576720433.248
- '0.0006136406750000235'
- - 1576720493.248
- '0.0006135999154761997'
- - 1576720553.248
- '0.0006126559190475756'
- - 1576720613.248
- '0.0006153160392857769'
- - 1576720673.248
- '0.0006146447178572262'
- - 1576720733.248
- '0.0006146970476189988'
- - 1576720793.248
- '0.0006219259035715042'
- - 1576720853.248
- '0.0006111198750001481'
- - 1576720913.248
- '0.0006169941035715337'
- - 1576720973.248
- '0.0006102626761905379'
- - 1576721033.248
- '0.0006163839964285346'
4320:
- metric: {}
values:
- - 1576719533.248
- '0.0006172414678571515'
- - 1576719593.248
- '0.0006189408976190352'
- - 1576719653.248
- '0.0006182154988094691'
- - 1576719713.248
- '0.0006194998404763076'
- - 1576719773.248
- '0.0006194687678569856'
- - 1576719833.248
- '0.0006171203535713976'
- - 1576719893.248
- '0.0006244061773808577'
- - 1576719953.248
- '0.0006170288511561634'
- - 1576720013.248
- '0.0006243750281248557'
- - 1576720073.248
- '0.0006152456571427256'
- - 1576720133.248
- '0.0006215679095237733'
- - 1576720193.248
- '0.0006218523571429083'
- - 1576720253.248
- '0.0006200312440475792'
- - 1576720313.248
- '0.0006214166202382676'
- - 1576720373.248
- '0.0006152486976191084'
- - 1576720433.248
- '0.0006136406750000235'
- - 1576720493.248
- '0.0006135999154761997'
- - 1576720553.248
- '0.0006126559190475756'
- - 1576720613.248
- '0.0006153160392857769'
- - 1576720673.248
- '0.0006146447178572262'
- - 1576720733.248
- '0.0006146970476189988'
- - 1576720793.248
- '0.0006219259035715042'
- - 1576720853.248
- '0.0006111198750001481'
- - 1576720913.248
- '0.0006169941035715337'
- - 1576720973.248
- '0.0006102626761905379'
- - 1576721033.248
- '0.0006163839964285346'
10080:
- metric: {}
values:
- - 1576719533.248
- '0.0006172414678571515'
- - 1576719593.248
- '0.0006189408976190352'
- - 1576719653.248
- '0.0006182154988094691'
- - 1576719713.248
- '0.0006194998404763076'
- - 1576719773.248
- '0.0006194687678569856'
- - 1576719833.248
- '0.0006171203535713976'
- - 1576719893.248
- '0.0006244061773808577'
- - 1576719953.248
- '0.0006170288511561634'
- - 1576720013.248
- '0.0006243750281248557'
- - 1576720073.248
- '0.0006152456571427256'
- - 1576720133.248
- '0.0006215679095237733'
- - 1576720193.248
- '0.0006218523571429083'
- - 1576720253.248
- '0.0006200312440475792'
- - 1576720313.248
- '0.0006214166202382676'
- - 1576720373.248
- '0.0006152486976191084'
- - 1576720433.248
- '0.0006136406750000235'
- - 1576720493.248
- '0.0006135999154761997'
- - 1576720553.248
- '0.0006126559190475756'
- - 1576720613.248
- '0.0006153160392857769'
- - 1576720673.248
- '0.0006146447178572262'
- - 1576720733.248
- '0.0006146970476189988'
- - 1576720793.248
- '0.0006219259035715042'
- - 1576720853.248
- '0.0006111198750001481'
- - 1576720913.248
- '0.0006169941035715337'
- - 1576720973.248
- '0.0006102626761905379'
- - 1576721033.248
- '0.0006163839964285346'

View File

@ -4,7 +4,10 @@ require 'spec_helper'
describe Metrics::SampleMetricsService do describe Metrics::SampleMetricsService do
describe 'query' do describe 'query' do
subject { described_class.new(identifier).query } let(:range_start) { '2019-12-02T23:31:45.000Z' }
let(:range_end) { '2019-12-03T00:01:45.000Z' }
subject { described_class.new(identifier, range_start: range_start, range_end: range_end).query }
context 'when the file is not found' do context 'when the file is not found' do
let(:identifier) { nil } let(:identifier) { nil }
@ -26,10 +29,10 @@ describe Metrics::SampleMetricsService do
FileUtils.rm(destination) FileUtils.rm(destination)
end end
subject { described_class.new(identifier).query } subject { described_class.new(identifier, range_start: range_start, range_end: range_end).query }
it 'loads data from the sample file correctly' do it 'loads data from the sample file correctly' do
expect(subject).to eq(YAML.load_file(source)) expect(subject).to eq(YAML.load_file(source)[30])
end end
end end

View File

@ -121,7 +121,7 @@ describe TaskListToggleService do
> * [x] Task 2 > * [x] Task 2
EOT EOT
markdown_html = Banzai::Pipeline::FullPipeline.call(markdown, project: nil)[:output].to_html markdown_html = parse_markdown(markdown)
toggler = described_class.new(markdown, markdown_html, toggler = described_class.new(markdown, markdown_html,
toggle_as_checked: true, toggle_as_checked: true,
line_source: '> > * [ ] Task 1', line_number: 1) line_source: '> > * [ ] Task 1', line_number: 1)
@ -142,7 +142,7 @@ describe TaskListToggleService do
* [x] Task 2 * [x] Task 2
EOT EOT
markdown_html = Banzai::Pipeline::FullPipeline.call(markdown, project: nil)[:output].to_html markdown_html = parse_markdown(markdown)
toggler = described_class.new(markdown, markdown_html, toggler = described_class.new(markdown, markdown_html,
toggle_as_checked: true, toggle_as_checked: true,
line_source: '* [ ] Task 1', line_number: 5) line_source: '* [ ] Task 1', line_number: 5)
@ -151,4 +151,44 @@ describe TaskListToggleService do
expect(toggler.updated_markdown.lines[4]).to eq "* [x] Task 1\n" expect(toggler.updated_markdown.lines[4]).to eq "* [x] Task 1\n"
expect(toggler.updated_markdown_html).to include('disabled checked> Task 1') expect(toggler.updated_markdown_html).to include('disabled checked> Task 1')
end end
context 'when clicking an embedded subtask' do
it 'properly handles it inside an unordered list' do
markdown =
<<-EOT.strip_heredoc
- - [ ] Task 1
- [x] Task 2
EOT
markdown_html = parse_markdown(markdown)
toggler = described_class.new(markdown, markdown_html,
toggle_as_checked: true,
line_source: '- - [ ] Task 1', line_number: 1)
expect(toggler.execute).to be_truthy
expect(toggler.updated_markdown.lines[0]).to eq "- - [x] Task 1\n"
expect(toggler.updated_markdown_html).to include('disabled checked> Task 1')
end
it 'properly handles it inside an ordered list' do
markdown =
<<-EOT.strip_heredoc
1. - [ ] Task 1
- [x] Task 2
EOT
markdown_html = parse_markdown(markdown)
toggler = described_class.new(markdown, markdown_html,
toggle_as_checked: true,
line_source: '1. - [ ] Task 1', line_number: 1)
expect(toggler.execute).to be_truthy
expect(toggler.updated_markdown.lines[0]).to eq "1. - [x] Task 1\n"
expect(toggler.updated_markdown_html).to include('disabled checked> Task 1')
end
end
def parse_markdown(markdown)
Banzai::Pipeline::FullPipeline.call(markdown, project: nil)[:output].to_html
end
end end

View File

@ -17,7 +17,7 @@ describe 'gitlab:generate_sample_prometheus_data rake task' do
it 'creates the file correctly' do it 'creates the file correctly' do
Rake.application.rake_require 'tasks/gitlab/generate_sample_prometheus_data' Rake.application.rake_require 'tasks/gitlab/generate_sample_prometheus_data'
allow(Environment).to receive(:find).and_return(environment) allow(Environment).to receive(:find).and_return(environment)
allow(environment).to receive_message_chain(:prometheus_adapter, :prometheus_client, :query_range) { sample_query_result } allow(environment).to receive_message_chain(:prometheus_adapter, :prometheus_client, :query_range) { sample_query_result[30] }
run_rake_task('gitlab:generate_sample_prometheus_data', [environment.id]) run_rake_task('gitlab:generate_sample_prometheus_data', [environment.id])
expect(File.exist?(sample_query_file)).to be true expect(File.exist?(sample_query_file)).to be true