提交 b5571e6e 编写于 作者: G GitLab Bot

Add latest changes from gitlab-org/gitlab@master

上级 f92a53a2
......@@ -23,7 +23,7 @@ build-qa-image:
stage: prepare
script:
- '[[ ! -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}"
- time docker pull "${QA_MASTER_IMAGE}"
- time docker build --cache-from "${QA_MASTER_IMAGE}" --tag ${QA_IMAGE} --file ./qa/Dockerfile ./
......
......@@ -2,13 +2,13 @@
import $ from 'jquery';
import _ from 'underscore';
import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
import Cookies from 'js-cookie';
import { __ } from './locale';
import { updateTooltipTitle } from './lib/utils/common_utils';
import { isInVueNoteablePage } from './lib/utils/dom_utils';
import flash from './flash';
import axios from './lib/utils/axios_utils';
import bp from './breakpoints';
const animationEndEventString = 'animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd';
const transitionEndEventString = 'transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd';
......
......@@ -2,7 +2,7 @@
class Projects::Environments::SampleMetricsController < Projects::ApplicationController
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
render json: { "status": "success", "data": { "resultType": "matrix", "result": result } }
......
......@@ -15,11 +15,11 @@ module Taskable
INCOMPLETE_PATTERN = /(\[[\s]\])/.freeze
ITEM_PATTERN = %r{
^
(?:(?:>\s{0,4})*) # optional blockquote characters
\s*(?:[-+*]|(?:\d+\.)) # list prefix required - task item has to be always in a list
\s+ # whitespace prefix has to be always presented for a list item
(\[\s\]|\[[xX]\]) # checkbox
(\s.+) # followed by whitespace and some text.
(?:(?:>\s{0,4})*) # optional blockquote characters
(?:\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\]|\[[xX]\]) # checkbox
(\s.+) # followed by whitespace and some text.
}x.freeze
def self.get_tasks(content)
......
......@@ -4,16 +4,17 @@ module Metrics
class SampleMetricsService
DIRECTORY = "sample_metrics"
attr_reader :identifier
attr_reader :identifier, :range_minutes
def initialize(identifier)
def initialize(identifier, range_start:, range_end:)
@identifier = identifier
@range_minutes = convert_range_minutes(range_start, range_end)
end
def query
return unless identifier && File.exist?(file_location)
YAML.load_file(File.expand_path(file_location, __dir__))
query_interval
end
private
......@@ -22,5 +23,14 @@ module Metrics
sanitized_string = identifier.gsub(/[^0-9A-Za-z_]/, '')
File.join(Rails.root, DIRECTORY, "#{sanitized_string}.yml")
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
---
title: Properly check a task embedded in a list with no text
merge_request: 21947
author:
type: fixed
---
title: Add full text search to pod logs
merge_request: 21656
author:
type: added
---
title: Rename common template jobs in sast and ds
merge_request: 22084
author:
type: fixed
---
title: Generate Prometheus sample metrics over pre-set intervals
merge_request: 22066
author:
type: added
---
title: Update Workhorse to v8.18.0
merge_request: 22091
author:
type: other
......@@ -58,6 +58,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get :trace, defaults: { format: 'json' }
get :raw
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
end
......@@ -235,6 +237,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get :metrics
get :additional_metrics
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 '/prometheus/api/v1/*proxy_path', to: 'environments/prometheus_api#proxy', as: :prometheus_api
......
......@@ -78,13 +78,27 @@ projects:
All Go projects should include these GitLab CI/CD jobs:
```yaml
go lint:
image: golang:1.11
lint:
image: registry.gitlab.com/gitlab-org/gitlab-build-images:golangci-lint-alpine
stage: test
script:
- go get -u golang.org/x/lint/golint
- golint -set_exit_status $(go list ./... | grep -v "vendor/")
# Use default .golangci.yml file from the image if one is not present in the project root.
- '[ -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)
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).
......
# Generate Sample Prometheus Data
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
under a `sample_metrics` directory as a yaml file named by the metric's `identifier`.
When the environmental variable `USE_SAMPLE_METRICS` is set, the Prometheus API query is
re-routed to `Projects::Environments::SampleMetricsController` which loads the appropriate
data set if it is present within the `sample_metrics` directory.
for a series of time intervals: 30 minutes, 3 hours, 8 hours, 24 hours, 72 hours, and 7 days
to now. The results of each of query are stored under a `sample_metrics` directory as a yaml
file named by the metric's `identifier`. When the environmental variable `USE_SAMPLE_METRICS`
is set, the Prometheus API query is re-routed to `Projects::Environments::SampleMetricsController`
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.
......
......@@ -72,7 +72,7 @@ dependency_scanning:
- $DEPENDENCY_SCANNING_DISABLED
- $DS_DISABLE_DIND == 'true'
.analyzer:
.ds-analyzer:
extends: dependency_scanning
services: []
except:
......@@ -82,7 +82,7 @@ dependency_scanning:
- /analyzer run
gemnasium-dependency_scanning:
extends: .analyzer
extends: .ds-analyzer
image:
name: "$DS_ANALYZER_IMAGE_PREFIX/gemnasium:$DS_MAJOR_VERSION"
only:
......@@ -92,7 +92,7 @@ gemnasium-dependency_scanning:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /ruby|javascript|php/
gemnasium-maven-dependency_scanning:
extends: .analyzer
extends: .ds-analyzer
image:
name: "$DS_ANALYZER_IMAGE_PREFIX/gemnasium-maven:$DS_MAJOR_VERSION"
only:
......@@ -102,7 +102,7 @@ gemnasium-maven-dependency_scanning:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /\bjava\b/
gemnasium-python-dependency_scanning:
extends: .analyzer
extends: .ds-analyzer
image:
name: "$DS_ANALYZER_IMAGE_PREFIX/gemnasium-python:$DS_MAJOR_VERSION"
only:
......@@ -112,7 +112,7 @@ gemnasium-python-dependency_scanning:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /python/
bundler-audit-dependency_scanning:
extends: .analyzer
extends: .ds-analyzer
image:
name: "$DS_ANALYZER_IMAGE_PREFIX/bundler-audit:$DS_MAJOR_VERSION"
only:
......@@ -122,7 +122,7 @@ bundler-audit-dependency_scanning:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /ruby/
retire-js-dependency_scanning:
extends: .analyzer
extends: .ds-analyzer
image:
name: "$DS_ANALYZER_IMAGE_PREFIX/retire.js:$DS_MAJOR_VERSION"
only:
......
......@@ -50,7 +50,7 @@ sast:
- $SAST_DISABLED
- $SAST_DISABLE_DIND == 'true'
.analyzer:
.sast-analyzer:
extends: sast
services: []
except:
......@@ -60,7 +60,7 @@ sast:
- /analyzer run
bandit-sast:
extends: .analyzer
extends: .sast-analyzer
image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/bandit:$SAST_ANALYZER_IMAGE_TAG"
only:
......@@ -70,7 +70,7 @@ bandit-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /python/
brakeman-sast:
extends: .analyzer
extends: .sast-analyzer
image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/brakeman:$SAST_ANALYZER_IMAGE_TAG"
only:
......@@ -80,7 +80,7 @@ brakeman-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /ruby/
eslint-sast:
extends: .analyzer
extends: .sast-analyzer
image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/eslint:$SAST_ANALYZER_IMAGE_TAG"
only:
......@@ -90,7 +90,7 @@ eslint-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /javascript/
flawfinder-sast:
extends: .analyzer
extends: .sast-analyzer
image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/flawfinder:$SAST_ANALYZER_IMAGE_TAG"
only:
......@@ -100,7 +100,7 @@ flawfinder-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /\b(c\+\+|c)\b/
kubesec-sast:
extends: .analyzer
extends: .sast-analyzer
image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/kubesec:$SAST_ANALYZER_IMAGE_TAG"
only:
......@@ -110,7 +110,7 @@ kubesec-sast:
$SCAN_KUBERNETES_MANIFESTS == 'true'
gosec-sast:
extends: .analyzer
extends: .sast-analyzer
image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/gosec:$SAST_ANALYZER_IMAGE_TAG"
only:
......@@ -120,7 +120,7 @@ gosec-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /\bgo\b/
nodejs-scan-sast:
extends: .analyzer
extends: .sast-analyzer
image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/nodejs-scan:$SAST_ANALYZER_IMAGE_TAG"
only:
......@@ -130,7 +130,7 @@ nodejs-scan-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /javascript/
phpcs-security-audit-sast:
extends: .analyzer
extends: .sast-analyzer
image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/phpcs-security-audit:$SAST_ANALYZER_IMAGE_TAG"
only:
......@@ -140,7 +140,7 @@ phpcs-security-audit-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /php/
pmd-apex-sast:
extends: .analyzer
extends: .sast-analyzer
image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/pmd-apex:$SAST_ANALYZER_IMAGE_TAG"
only:
......@@ -150,7 +150,7 @@ pmd-apex-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /apex/
secrets-sast:
extends: .analyzer
extends: .sast-analyzer
image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/secrets:$SAST_ANALYZER_IMAGE_TAG"
only:
......@@ -159,7 +159,7 @@ secrets-sast:
$SAST_DEFAULT_ANALYZERS =~ /secrets/
security-code-scan-sast:
extends: .analyzer
extends: .sast-analyzer
image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/security-code-scan:$SAST_ANALYZER_IMAGE_TAG"
only:
......@@ -169,7 +169,7 @@ security-code-scan-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /\b(c\#|visual basic\b)/
sobelow-sast:
extends: .analyzer
extends: .sast-analyzer
image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/sobelow:$SAST_ANALYZER_IMAGE_TAG"
only:
......@@ -179,7 +179,7 @@ sobelow-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /elixir/
spotbugs-sast:
extends: .analyzer
extends: .sast-analyzer
image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/spotbugs:$SAST_ANALYZER_IMAGE_TAG"
only:
......@@ -189,7 +189,7 @@ spotbugs-sast:
$CI_PROJECT_REPOSITORY_LANGUAGES =~ /java\b/
tslint-sast:
extends: .analyzer
extends: .sast-analyzer
image:
name: "$SAST_ANALYZER_IMAGE_PREFIX/tslint:$SAST_ANALYZER_IMAGE_TAG"
only:
......
......@@ -8,12 +8,17 @@ namespace :gitlab do
sample_metrics_directory_name = Metrics::SampleMetricsService::DIRECTORY
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|
query = metric.query % query_variables
result = environment.prometheus_adapter.prometheus_client.query_range(query, start: 7.days.ago)
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)
end
end
......
......@@ -6896,6 +6896,9 @@ msgstr ""
msgid "Environments|Rollback environment %{name}?"
msgstr ""
msgid "Environments|Search"
msgstr ""
msgid "Environments|Show all"
msgstr ""
......
......@@ -24,12 +24,8 @@ module QA
project = Resource::Project.fabricate_via_api! do |resource|
resource.name = 'xss-test-for-mentions-project'
end
project.visit!
Page::Project::Show.perform(&:go_to_members_settings)
Page::Project::Settings::Members.perform do |members|
members.add_member(user.username)
end
Flow::Project.add_member(project: project, username: user.username)
issue = Resource::Issue.fabricate_via_api! do |issue|
issue.title = 'issue title'
......@@ -42,7 +38,7 @@ module QA
show.comment("cc-ing you here @#{user.username}")
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
end
......
......@@ -58,7 +58,9 @@ describe Projects::Environments::SampleMetricsController do
id: environment.id.to_s,
namespace_id: project.namespace.full_path,
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)
end
end
---
30:
- metric: {}
values:
- - 1573560714.209
- '0.02361297607421875'
- - 1573560774.209
- '0.02361297607421875'
- - 1573560834.209
- '0.02362823486328125'
- - 1573560894.209
- '0.02361297607421875'
- - 1573560954.209
- '0.02385711669921875'
- - 1573561014.209
- '0.02361297607421875'
- - 1573561074.209
- '0.02361297607421875'
- - 1573561134.209
- '0.02362060546875'
- - 1573561194.209
- '0.02362060546875'
- - 1573561254.209
- '0.02362060546875'
- - 1573561314.209
- '0.02362060546875'
- - 1573561374.209
- '0.023624420166015625'
- - 1573561434.209
- '0.023651123046875'
- - 1573561494.209
- '0.02362060546875'
- - 1573561554.209
- '0.0236358642578125'
- - 1573561614.209
- '0.02362060546875'
- - 1573561674.209
- '0.02362060546875'
- - 1573561734.209
- '0.02362060546875'
- - 1573561794.209
- '0.02362060546875'
- - 1573561854.209
- '0.02362060546875'
- - 1573561914.209
- '0.023651123046875'
- - 1573561974.209
- '0.02362060546875'
- - 1573562034.209
- '0.02362060546875'
- - 1573562094.209
- '0.02362060546875'
- - 1573562154.209
- '0.02362060546875'
- - 1573562214.209
- '0.023624420166015625'
- - 1573562274.209
- '0.02362060546875'
- - 1573562334.209
- '0.023868560791015625'
- - 1573562394.209
- '0.02374267578125'
- - 1573562454.209
- '0.02362060546875'
- - 1573562514.209
- '0.02362060546875'
- - 1573562574.209
- '0.02362060546875'
- - 1573562634.209
- '0.02362060546875'
- - 1573562694.209
- '0.023639678955078125'
- - 1573562754.209
- '0.0236358642578125'
- - 1573562814.209
- '0.02362060546875'
- - 1573562874.209
- '0.0236358642578125'
- - 1573562934.209
- '0.023651123046875'
- - 1573562994.209
- '0.02362060546875'
- - 1573563054.209
- '0.023624420166015625'
- - 1573563114.209
- '0.02362060546875'
- - 1573563174.209
- '0.02362060546875'
- - 1573563234.209
- '0.02362060546875'
- - 1573563294.209
- '0.02362060546875'
- - 1573563354.209
- '0.02362060546875'
- - 1573563414.209
- '0.023651123046875'
- - 1573563474.209
- '0.023651123046875'
- - 1573563534.209
- '0.023651123046875'
- - 1573563594.209
- '0.023773193359375'
- - 1573563654.209
- '0.023681640625'
- - 1573563714.209
- '0.023895263671875'
- - 1573563774.209
- '0.023651123046875'
- - 1573563834.209
- '0.023651123046875'
- - 1573563894.209
- '0.023651123046875'
- - 1573563954.209
- '0.0236663818359375'
- - 1573564014.209
- '0.023651123046875'
- - 1573564074.209
- '0.023681640625'
- - 1573564134.209
- '0.0236663818359375'
- - 1573564194.209
- '0.0236663818359375'
- - 1573564254.209
- '0.023651123046875'
- - 1573564314.209
- '0.023651123046875'
- - 1573564374.209
- '0.023651123046875'
- - 1573564434.209
- '0.023773193359375'
- - 1573564494.209
- '0.023651123046875'
- - 1573564554.209
- '0.023681640625'
- - 1573564614.209
- '0.023773193359375'
- - 1573564674.209
- '0.023651123046875'
- - 1573564734.209
- '0.023651123046875'
- - 1573564794.209
- '0.023651123046875'
- - 1573564854.209
- '0.023651123046875'
- - 1573564914.209
- '0.023651123046875'
- - 1573564974.209
- '0.023651123046875'
- - 1573565034.209
- '0.023651123046875'
- - 1573565094.209
- '0.023895263671875'
\ No newline at end of file
- - 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'
180:
- 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'
480:
- 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'
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'
\ No newline at end of file
......@@ -4,7 +4,10 @@ require 'spec_helper'
describe Metrics::SampleMetricsService 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
let(:identifier) { nil }
......@@ -26,10 +29,10 @@ describe Metrics::SampleMetricsService do
FileUtils.rm(destination)
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
expect(subject).to eq(YAML.load_file(source))
expect(subject).to eq(YAML.load_file(source)[30])
end
end
......
......@@ -121,7 +121,7 @@ describe TaskListToggleService do
> * [x] Task 2
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,
toggle_as_checked: true,
line_source: '> > * [ ] Task 1', line_number: 1)
......@@ -142,7 +142,7 @@ describe TaskListToggleService do
* [x] Task 2
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,
toggle_as_checked: true,
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_html).to include('disabled checked> Task 1')
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
......@@ -17,7 +17,7 @@ describe 'gitlab:generate_sample_prometheus_data rake task' do
it 'creates the file correctly' do
Rake.application.rake_require 'tasks/gitlab/generate_sample_prometheus_data'
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])
expect(File.exist?(sample_query_file)).to be true
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册