summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab/ci/review.gitlab-ci.yml2
-rw-r--r--GITLAB_WORKHORSE_VERSION2
-rw-r--r--app/assets/javascripts/awards_handler.js2
-rw-r--r--app/controllers/projects/environments/sample_metrics_controller.rb2
-rw-r--r--app/models/concerns/taskable.rb10
-rw-r--r--app/services/metrics/sample_metrics_service.rb16
-rw-r--r--changelogs/unreleased/27296-incorrect-task-list-checked-with-embedded-subtasks.yml5
-rw-r--r--changelogs/unreleased/ak-logs-search-4.yml5
-rw-r--r--changelogs/unreleased/fix-conflict-dast-ds.yml5
-rw-r--r--changelogs/unreleased/generate-sample-metrics-intervals.yml5
-rw-r--r--changelogs/unreleased/workhorse-8-18.yml5
-rw-r--r--config/routes/project.rb4
-rw-r--r--doc/development/go_guide/index.md22
-rw-r--r--doc/raketasks/generate_sample_prometheus_data.md10
-rw-r--r--lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml12
-rw-r--r--lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml30
-rw-r--r--lib/tasks/gitlab/generate_sample_prometheus_data.rake7
-rw-r--r--locale/gitlab.pot3
-rw-r--r--qa/qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb8
-rw-r--r--spec/controllers/projects/environments/sample_metrics_controller_spec.rb4
-rw-r--r--spec/fixtures/gitlab/sample_metrics/sample_metric_query_result.yml477
-rw-r--r--spec/services/metrics/sample_metrics_service_spec.rb9
-rw-r--r--spec/services/task_list_toggle_service_spec.rb44
-rw-r--r--spec/tasks/gitlab/generate_sample_prometheus_data_spec.rb2
24 files changed, 487 insertions, 204 deletions
diff --git a/.gitlab/ci/review.gitlab-ci.yml b/.gitlab/ci/review.gitlab-ci.yml
index 49447bc629b..11fef55d8f7 100644
--- a/.gitlab/ci/review.gitlab-ci.yml
+++ b/.gitlab/ci/review.gitlab-ci.yml
@@ -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 ./
diff --git a/GITLAB_WORKHORSE_VERSION b/GITLAB_WORKHORSE_VERSION
index 29d3fcd5549..38b5f0deaee 100644
--- a/GITLAB_WORKHORSE_VERSION
+++ b/GITLAB_WORKHORSE_VERSION
@@ -1 +1 @@
-8.17.0
+8.18.0
diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js
index aaab217964c..2fc8b9efc1b 100644
--- a/app/assets/javascripts/awards_handler.js
+++ b/app/assets/javascripts/awards_handler.js
@@ -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';
diff --git a/app/controllers/projects/environments/sample_metrics_controller.rb b/app/controllers/projects/environments/sample_metrics_controller.rb
index 79a7eab150b..9176c7cbd56 100644
--- a/app/controllers/projects/environments/sample_metrics_controller.rb
+++ b/app/controllers/projects/environments/sample_metrics_controller.rb
@@ -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 } }
diff --git a/app/models/concerns/taskable.rb b/app/models/concerns/taskable.rb
index 98842242eb6..5debfa6f834 100644
--- a/app/models/concerns/taskable.rb
+++ b/app/models/concerns/taskable.rb
@@ -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)
diff --git a/app/services/metrics/sample_metrics_service.rb b/app/services/metrics/sample_metrics_service.rb
index 719bc6614e4..9bf32b295e2 100644
--- a/app/services/metrics/sample_metrics_service.rb
+++ b/app/services/metrics/sample_metrics_service.rb
@@ -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
diff --git a/changelogs/unreleased/27296-incorrect-task-list-checked-with-embedded-subtasks.yml b/changelogs/unreleased/27296-incorrect-task-list-checked-with-embedded-subtasks.yml
new file mode 100644
index 00000000000..0da9ebfe8d5
--- /dev/null
+++ b/changelogs/unreleased/27296-incorrect-task-list-checked-with-embedded-subtasks.yml
@@ -0,0 +1,5 @@
+---
+title: Properly check a task embedded in a list with no text
+merge_request: 21947
+author:
+type: fixed
diff --git a/changelogs/unreleased/ak-logs-search-4.yml b/changelogs/unreleased/ak-logs-search-4.yml
new file mode 100644
index 00000000000..b26db8e5142
--- /dev/null
+++ b/changelogs/unreleased/ak-logs-search-4.yml
@@ -0,0 +1,5 @@
+---
+title: Add full text search to pod logs
+merge_request: 21656
+author:
+type: added
diff --git a/changelogs/unreleased/fix-conflict-dast-ds.yml b/changelogs/unreleased/fix-conflict-dast-ds.yml
new file mode 100644
index 00000000000..fd05ec2e7d9
--- /dev/null
+++ b/changelogs/unreleased/fix-conflict-dast-ds.yml
@@ -0,0 +1,5 @@
+---
+title: Rename common template jobs in sast and ds
+merge_request: 22084
+author:
+type: fixed
diff --git a/changelogs/unreleased/generate-sample-metrics-intervals.yml b/changelogs/unreleased/generate-sample-metrics-intervals.yml
new file mode 100644
index 00000000000..4434671ec91
--- /dev/null
+++ b/changelogs/unreleased/generate-sample-metrics-intervals.yml
@@ -0,0 +1,5 @@
+---
+title: Generate Prometheus sample metrics over pre-set intervals
+merge_request: 22066
+author:
+type: added
diff --git a/changelogs/unreleased/workhorse-8-18.yml b/changelogs/unreleased/workhorse-8-18.yml
new file mode 100644
index 00000000000..97deafcf02c
--- /dev/null
+++ b/changelogs/unreleased/workhorse-8-18.yml
@@ -0,0 +1,5 @@
+---
+title: Update Workhorse to v8.18.0
+merge_request: 22091
+author:
+type: other
diff --git a/config/routes/project.rb b/config/routes/project.rb
index e8ad8ba2a63..9e40e891fd5 100644
--- a/config/routes/project.rb
+++ b/config/routes/project.rb
@@ -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
diff --git a/doc/development/go_guide/index.md b/doc/development/go_guide/index.md
index 724bc240bc2..f6aae945f62 100644
--- a/doc/development/go_guide/index.md
+++ b/doc/development/go_guide/index.md
@@ -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).
diff --git a/doc/raketasks/generate_sample_prometheus_data.md b/doc/raketasks/generate_sample_prometheus_data.md
index 2489a2c2ad3..bb0ed68ec0f 100644
--- a/doc/raketasks/generate_sample_prometheus_data.md
+++ b/doc/raketasks/generate_sample_prometheus_data.md
@@ -1,11 +1,11 @@
# 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.
diff --git a/lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml b/lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml
index e531f6316e1..d73f6ccdb3f 100644
--- a/lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml
@@ -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:
diff --git a/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml b/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml
index 75594eeb619..34d84138a8b 100644
--- a/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml
@@ -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:
diff --git a/lib/tasks/gitlab/generate_sample_prometheus_data.rake b/lib/tasks/gitlab/generate_sample_prometheus_data.rake
index a988494ca61..250eaaa5568 100644
--- a/lib/tasks/gitlab/generate_sample_prometheus_data.rake
+++ b/lib/tasks/gitlab/generate_sample_prometheus_data.rake
@@ -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
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 719e8084c55..b3672f4ca6d 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -6896,6 +6896,9 @@ msgstr ""
msgid "Environments|Rollback environment %{name}?"
msgstr ""
+msgid "Environments|Search"
+msgstr ""
+
msgid "Environments|Show all"
msgstr ""
diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb
index 494108dbefc..358083d3f1d 100644
--- a/qa/qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb
+++ b/qa/qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb
@@ -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
diff --git a/spec/controllers/projects/environments/sample_metrics_controller_spec.rb b/spec/controllers/projects/environments/sample_metrics_controller_spec.rb
index 4faa3ecb567..a1fec46d3a0 100644
--- a/spec/controllers/projects/environments/sample_metrics_controller_spec.rb
+++ b/spec/controllers/projects/environments/sample_metrics_controller_spec.rb
@@ -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
diff --git a/spec/fixtures/gitlab/sample_metrics/sample_metric_query_result.yml b/spec/fixtures/gitlab/sample_metrics/sample_metric_query_result.yml
index ba074912b3b..ce49f551082 100644
--- a/spec/fixtures/gitlab/sample_metrics/sample_metric_query_result.yml
+++ b/spec/fixtures/gitlab/sample_metrics/sample_metric_query_result.yml
@@ -1,151 +1,332 @@
---
+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
diff --git a/spec/services/metrics/sample_metrics_service_spec.rb b/spec/services/metrics/sample_metrics_service_spec.rb
index 8574674ebc4..3b4f7cb8062 100644
--- a/spec/services/metrics/sample_metrics_service_spec.rb
+++ b/spec/services/metrics/sample_metrics_service_spec.rb
@@ -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
diff --git a/spec/services/task_list_toggle_service_spec.rb b/spec/services/task_list_toggle_service_spec.rb
index a309951bbcb..82a5446dcb8 100644
--- a/spec/services/task_list_toggle_service_spec.rb
+++ b/spec/services/task_list_toggle_service_spec.rb
@@ -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
diff --git a/spec/tasks/gitlab/generate_sample_prometheus_data_spec.rb b/spec/tasks/gitlab/generate_sample_prometheus_data_spec.rb
index 72e61f5c524..7620047624a 100644
--- a/spec/tasks/gitlab/generate_sample_prometheus_data_spec.rb
+++ b/spec/tasks/gitlab/generate_sample_prometheus_data_spec.rb
@@ -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