diff --git a/CHANGELOG-EE.md b/CHANGELOG-EE.md index 547da1cff1e..0fb9f5d2b76 100644 --- a/CHANGELOG-EE.md +++ b/CHANGELOG-EE.md @@ -335,6 +335,13 @@ Please view this file on the master branch, on stable branches it's out of date. - Translate unauthenticated user string for Audit Event. !31856 (Sashi Kumar) +## 12.10.8 (2020-05-28) + +### Fixed (1 change) + +- Geo: Fix empty synchronisation status when nothing is synchronised. !30710 + + ## 12.10.7 (2020-05-27) ### Security (3 changes) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54102c6b482..42db479eeb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,6 @@ documentation](doc/development/changelog.md) for instructions on adding your own entry. -## 13.0.2 (2020-05-28) - -- No changes. - ## 13.0.1 (2020-05-27) ### Security (12 changes) @@ -593,6 +589,14 @@ entry. - Use visitUrl in Alert management. !32414 +## 12.10.8 (2020-05-28) + +### Fixed (2 changes) + +- Fix Geo replication for design thumbnails. !32703 +- Fix 404s downloading build artifacts. !32741 + + ## 12.10.7 (2020-05-27) ### Security (14 changes) diff --git a/Gemfile b/Gemfile index 534b2dab884..aa1de393419 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -gem 'rails', '~> 6.0.3' +gem 'rails', '~> 6.0.3.1' gem 'bootsnap', '~> 1.4.6' diff --git a/Gemfile.lock b/Gemfile.lock index 05c8e40a9c9..78580a3fd6c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,59 +6,59 @@ GEM ace-rails-ap (4.1.2) acme-client (2.0.5) faraday (~> 0.9, >= 0.9.1) - actioncable (6.0.3) - actionpack (= 6.0.3) + actioncable (6.0.3.1) + actionpack (= 6.0.3.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.3) - actionpack (= 6.0.3) - activejob (= 6.0.3) - activerecord (= 6.0.3) - activestorage (= 6.0.3) - activesupport (= 6.0.3) + actionmailbox (6.0.3.1) + actionpack (= 6.0.3.1) + activejob (= 6.0.3.1) + activerecord (= 6.0.3.1) + activestorage (= 6.0.3.1) + activesupport (= 6.0.3.1) mail (>= 2.7.1) - actionmailer (6.0.3) - actionpack (= 6.0.3) - actionview (= 6.0.3) - activejob (= 6.0.3) + actionmailer (6.0.3.1) + actionpack (= 6.0.3.1) + actionview (= 6.0.3.1) + activejob (= 6.0.3.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.3) - actionview (= 6.0.3) - activesupport (= 6.0.3) + actionpack (6.0.3.1) + actionview (= 6.0.3.1) + activesupport (= 6.0.3.1) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.3) - actionpack (= 6.0.3) - activerecord (= 6.0.3) - activestorage (= 6.0.3) - activesupport (= 6.0.3) + actiontext (6.0.3.1) + actionpack (= 6.0.3.1) + activerecord (= 6.0.3.1) + activestorage (= 6.0.3.1) + activesupport (= 6.0.3.1) nokogiri (>= 1.8.5) - actionview (6.0.3) - activesupport (= 6.0.3) + actionview (6.0.3.1) + activesupport (= 6.0.3.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.3) - activesupport (= 6.0.3) + activejob (6.0.3.1) + activesupport (= 6.0.3.1) globalid (>= 0.3.6) - activemodel (6.0.3) - activesupport (= 6.0.3) - activerecord (6.0.3) - activemodel (= 6.0.3) - activesupport (= 6.0.3) + activemodel (6.0.3.1) + activesupport (= 6.0.3.1) + activerecord (6.0.3.1) + activemodel (= 6.0.3.1) + activesupport (= 6.0.3.1) activerecord-explain-analyze (0.1.0) activerecord (>= 4) pg - activestorage (6.0.3) - actionpack (= 6.0.3) - activejob (= 6.0.3) - activerecord (= 6.0.3) + activestorage (6.0.3.1) + actionpack (= 6.0.3.1) + activejob (= 6.0.3.1) + activerecord (= 6.0.3.1) marcel (~> 0.3.1) - activesupport (6.0.3) + activesupport (6.0.3.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -801,20 +801,20 @@ GEM rack-test (1.1.0) rack (>= 1.0, < 3) rack-timeout (0.5.1) - rails (6.0.3) - actioncable (= 6.0.3) - actionmailbox (= 6.0.3) - actionmailer (= 6.0.3) - actionpack (= 6.0.3) - actiontext (= 6.0.3) - actionview (= 6.0.3) - activejob (= 6.0.3) - activemodel (= 6.0.3) - activerecord (= 6.0.3) - activestorage (= 6.0.3) - activesupport (= 6.0.3) + rails (6.0.3.1) + actioncable (= 6.0.3.1) + actionmailbox (= 6.0.3.1) + actionmailer (= 6.0.3.1) + actionpack (= 6.0.3.1) + actiontext (= 6.0.3.1) + actionview (= 6.0.3.1) + activejob (= 6.0.3.1) + activemodel (= 6.0.3.1) + activerecord (= 6.0.3.1) + activestorage (= 6.0.3.1) + activesupport (= 6.0.3.1) bundler (>= 1.3.0) - railties (= 6.0.3) + railties (= 6.0.3.1) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.4) actionpack (>= 5.0.1.x) @@ -828,9 +828,9 @@ GEM rails-i18n (6.0.0) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 7) - railties (6.0.3) - actionpack (= 6.0.3) - activesupport (= 6.0.3) + railties (6.0.3.1) + actionpack (= 6.0.3.1) + activesupport (= 6.0.3.1) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) @@ -1335,7 +1335,7 @@ DEPENDENCIES rack-oauth2 (~> 1.9.3) rack-proxy (~> 0.6.0) rack-timeout - rails (~> 6.0.3) + rails (~> 6.0.3.1) rails-controller-testing rails-i18n (~> 6.0) rainbow (~> 3.0) diff --git a/app/assets/javascripts/pages/projects/labels/components/promote_label_modal.vue b/app/assets/javascripts/pages/projects/labels/components/promote_label_modal.vue index 3b26047455d..2e3ed15e50f 100644 --- a/app/assets/javascripts/pages/projects/labels/components/promote_label_modal.vue +++ b/app/assets/javascripts/pages/projects/labels/components/promote_label_modal.vue @@ -90,7 +90,9 @@ export default { footer-primary-button-variant="warning" @submit="onSubmit" > - + {{ text }} diff --git a/app/models/metrics/dashboard/annotation.rb b/app/models/metrics/dashboard/annotation.rb index 8166880f0c9..3383dda20c9 100644 --- a/app/models/metrics/dashboard/annotation.rb +++ b/app/models/metrics/dashboard/annotation.rb @@ -3,6 +3,8 @@ module Metrics module Dashboard class Annotation < ApplicationRecord + include DeleteWithLimit + self.table_name = 'metrics_dashboard_annotations' belongs_to :environment, inverse_of: :metrics_dashboard_annotations @@ -14,14 +16,25 @@ module Metrics validates :panel_xid, length: { maximum: 255 } validate :single_ownership validate :orphaned_annotation + validate :ending_at_after_starting_at scope :after, ->(after) { where('starting_at >= ?', after) } scope :before, ->(before) { where('starting_at <= ?', before) } scope :for_dashboard, ->(dashboard_path) { where(dashboard_path: dashboard_path) } + scope :ending_before, ->(timestamp) { where('COALESCE(ending_at, starting_at) < ?', timestamp) } private + # If annotation has NULL in ending_at column that indicates, that this annotation IS TIED TO SINGLE POINT + # IN TIME designated by starting_at timestamp. It does NOT mean that annotation is ever going starting from + # stating_at timestamp + def ending_at_after_starting_at + return if ending_at.blank? || starting_at.blank? || starting_at <= ending_at + + errors.add(:ending_at, s_("Metrics::Dashboard::Annotation|can't be before starting_at time")) + end + def single_ownership return if cluster.nil? ^ environment.nil? diff --git a/changelogs/unreleased/218557-geo-design-thumbnails-are-not-replicated.yml b/changelogs/unreleased/218557-geo-design-thumbnails-are-not-replicated.yml deleted file mode 100644 index 73ebbb06630..00000000000 --- a/changelogs/unreleased/218557-geo-design-thumbnails-are-not-replicated.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Fix Geo replication for design thumbnails -merge_request: 32703 -author: -type: fixed diff --git a/changelogs/unreleased/mwaw-211433-metrics-dashboard-annotations-reaper-job-database-layer.yml b/changelogs/unreleased/mwaw-211433-metrics-dashboard-annotations-reaper-job-database-layer.yml new file mode 100644 index 00000000000..454f6aab8e9 --- /dev/null +++ b/changelogs/unreleased/mwaw-211433-metrics-dashboard-annotations-reaper-job-database-layer.yml @@ -0,0 +1,6 @@ +--- +title: Table index added to `metrics_dashboard_annotations` for future pruning of stale metrics + Annotations for metrics dashboards are now checked for valid start and end dates. +merge_request: 32433 +author: +type: added diff --git a/changelogs/unreleased/sh-fix-artifacts-download-404.yml b/changelogs/unreleased/sh-fix-artifacts-download-404.yml deleted file mode 100644 index 37615394344..00000000000 --- a/changelogs/unreleased/sh-fix-artifacts-download-404.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Fix 404s downloading build artifacts -merge_request: 32741 -author: -type: fixed diff --git a/changelogs/unreleased/update-deprecated-slot-syntax-in---app-assets-javascripts-pages-projects-.yml b/changelogs/unreleased/update-deprecated-slot-syntax-in---app-assets-javascripts-pages-projects-.yml new file mode 100644 index 00000000000..8ee3646bcd1 --- /dev/null +++ b/changelogs/unreleased/update-deprecated-slot-syntax-in---app-assets-javascripts-pages-projects-.yml @@ -0,0 +1,5 @@ +--- +title: Update deprecated slot syntax in ./app/assets/javascripts/pages/projects/labels/components/promote_label_modal.vue +merge_request: 31995 +author: Gilang Gumilar +type: other diff --git a/db/post_migrate/20200518133123_add_index_on_starting_ending_at_to_metrics_dashboard_annotations.rb b/db/post_migrate/20200518133123_add_index_on_starting_ending_at_to_metrics_dashboard_annotations.rb new file mode 100644 index 00000000000..3094fff0d1d --- /dev/null +++ b/db/post_migrate/20200518133123_add_index_on_starting_ending_at_to_metrics_dashboard_annotations.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexOnStartingEndingAtToMetricsDashboardAnnotations < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_metrics_dashboard_annotations_on_timespan_end' + + disable_ddl_transaction! + + def up + add_concurrent_index :metrics_dashboard_annotations, 'COALESCE(ending_at, starting_at)', name: INDEX_NAME + end + + def down + remove_concurrent_index :metrics_dashboard_annotations, 'COALESCE(ending_at, starting_at)', name: INDEX_NAME + end +end diff --git a/db/structure.sql b/db/structure.sql index f8ed845cb77..f35e1a2e3df 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -10082,6 +10082,8 @@ CREATE INDEX index_metrics_dashboard_annotations_on_cluster_id_and_3_columns ON CREATE INDEX index_metrics_dashboard_annotations_on_environment_id_and_3_col ON public.metrics_dashboard_annotations USING btree (environment_id, dashboard_path, starting_at, ending_at) WHERE (environment_id IS NOT NULL); +CREATE INDEX index_metrics_dashboard_annotations_on_timespan_end ON public.metrics_dashboard_annotations USING btree (COALESCE(ending_at, starting_at)); + CREATE INDEX index_metrics_users_starred_dashboards_on_project_id ON public.metrics_users_starred_dashboards USING btree (project_id); CREATE INDEX index_milestone_releases_on_release_id ON public.milestone_releases USING btree (release_id); @@ -13948,6 +13950,7 @@ COPY "schema_migrations" (version) FROM STDIN; 20200514000340 20200515155620 20200518091745 +20200518133123 20200519115908 20200519171058 20200519194042 diff --git a/doc/.vale/gitlab/spelling-exceptions.txt b/doc/.vale/gitlab/spelling-exceptions.txt index c5e89f72043..f011098d16d 100644 --- a/doc/.vale/gitlab/spelling-exceptions.txt +++ b/doc/.vale/gitlab/spelling-exceptions.txt @@ -5,6 +5,7 @@ Ansible Anthos API approvers +architected Artifactory Asana Asciidoctor @@ -25,6 +26,7 @@ autoscaler autoscales autoscaling awardable +Axios Azure backport backported @@ -154,6 +156,7 @@ Jaeger Jenkins Jira jQuery +jsdom JupyterHub kanban kanbans @@ -380,6 +383,7 @@ unmergeable unmerged unmerges unmerging +unmocked unoptimize unoptimized unoptimizes diff --git a/doc/api/graphql/reference/gitlab_schema.graphql b/doc/api/graphql/reference/gitlab_schema.graphql index 7a814b3a4f4..c440922f6a9 100644 --- a/doc/api/graphql/reference/gitlab_schema.graphql +++ b/doc/api/graphql/reference/gitlab_schema.graphql @@ -12008,6 +12008,11 @@ type Vulnerability { """ title: String + """ + Number of user notes attached to the vulnerability + """ + userNotesCount: Int! + """ Permissions for the current user on the resource """ diff --git a/doc/api/graphql/reference/gitlab_schema.json b/doc/api/graphql/reference/gitlab_schema.json index e34127de1e8..c64a86659b2 100644 --- a/doc/api/graphql/reference/gitlab_schema.json +++ b/doc/api/graphql/reference/gitlab_schema.json @@ -35537,6 +35537,24 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "userNotesCount", + "description": "Number of user notes attached to the vulnerability", + "args": [ + + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "userPermissions", "description": "Permissions for the current user on the resource", diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index e6247790671..336363cf328 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -1816,6 +1816,7 @@ Represents a vulnerability. | `severity` | VulnerabilitySeverity | Severity of the vulnerability (INFO, UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL) | | `state` | VulnerabilityState | State of the vulnerability (DETECTED, DISMISSED, RESOLVED, CONFIRMED) | | `title` | String | Title of the vulnerability | +| `userNotesCount` | Int! | Number of user notes attached to the vulnerability | | `userPermissions` | VulnerabilityPermissions! | Permissions for the current user on the resource | | `vulnerabilityPath` | String | URL to the vulnerability's details page | diff --git a/doc/development/documentation/styleguide.md b/doc/development/documentation/styleguide.md index 1f29721f19d..5930463d6b4 100644 --- a/doc/development/documentation/styleguide.md +++ b/doc/development/documentation/styleguide.md @@ -134,6 +134,8 @@ be ignored by markdownlint. In general, product names should follow the exact capitalization of the official names of the products, protocols, and so on. +See [`.markdownlint.json`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.markdownlint.json) +for the words tested for proper capitalization in GitLab documentation. Some examples fail if incorrect capitalization is used: @@ -246,13 +248,14 @@ Do not include the same information in multiple places. [Link to a SSOT instead. GitLab documentation should be clear and easy to understand. - Be clear, concise, and stick to the goal of the documentation. -- Write in US English with US grammar. +- Write in US English with US grammar. (Tested in [`British.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/.vale/gitlab/British.yml).) - Use inclusive language. ### Point of view In most cases, it’s appropriate to use the second-person (you, yours) point of view, because it’s friendly and easy to understand. +(Tested in [`FirstPerson.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/.vale/gitlab/FirstPerson.yml).) @@ -272,10 +275,11 @@ because it’s friendly and easy to understand. - [GitLab Features](https://about.gitlab.com/features/). For example, Issue Board, Geo, and Runner. - GitLab [product tiers](https://about.gitlab.com/pricing/). For example, GitLab Core - and GitLab Ultimate. + and GitLab Ultimate. (Tested in [`BadgeCapitalization.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/.vale/gitlab/BadgeCapitalization.yml).) - Third-party products. For example, Prometheus, Kubernetes, and Git. - Methods or methodologies. For example, Continuous Integration, Continuous Deployment, Scrum, and Agile. + (Tested in [`.markdownlint.json`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.markdownlint.json).) NOTE: **Note:** Some features are also objects. For example, "GitLab's Merge Requests support X" and @@ -289,6 +293,7 @@ tenses, words, and phrases: - Avoid jargon. - Avoid uncommon words. - Don't write in the first person singular. + (Tested in [`FirstPerson.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/.vale/gitlab/FirstPerson.yml).) - Instead of "I" or "me," use "we," "you," "us," or "one." - When possible, stay user focused by writing in the second person ("you" or the imperative). @@ -311,6 +316,7 @@ tenses, words, and phrases: - We discourage use of Latin abbreviations, such as "e.g.," "i.e.," or "etc.," as even native users of English might misunderstand them. + (Tested in [`LatinTerms.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/.vale/gitlab/LatinTerms.yml).) - Instead of "i.e.," use "that is." - Instead of "e.g.," use "for example," "such as," "for instance," or "like." - Instead of "etc.," either use "and so on" or consider editing it out, since @@ -331,7 +337,7 @@ tenses, words, and phrases: ### Contractions -- Use common contractions when it helps create a friendly and informal tone, especially in tutorials, instructional documentation, and [UIs](https://design.gitlab.com/content/punctuation/#contractions). +- Use common contractions when it helps create a friendly and informal tone, especially in tutorials, instructional documentation, and [UIs](https://design.gitlab.com/content/punctuation/#contractions). (Tested in [`Contractions.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/.vale/gitlab/Contractions.yml).) | Do | Don't | |----------|-----------| @@ -414,9 +420,9 @@ Check specific punctuation rules for [lists](#lists) below. | ---- | ------- | | Always end full sentences with a period. | _For a complete overview, read through this document._| | Always add a space after a period when beginning a new sentence. | _For a complete overview, check this doc. For other references, check out this guide._ | -| Do not use double spaces. | --- | +| Do not use double spaces. (Tested in [`SentenceSpacing.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/.vale/gitlab/SentenceSpacing.yml).) | --- | | Do not use tabs for indentation. Use spaces instead. You can configure your code editor to output spaces instead of tabs when pressing the tab key. | --- | -| Use serial commas ("Oxford commas") before the final 'and/or' in a list. | _You can create new issues, merge requests, and milestones._ | +| Use serial commas ("Oxford commas") before the final 'and/or' in a list. (Tested in [`OxfordComma.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/.vale/gitlab/OxfordComma.yml).) | _You can create new issues, merge requests, and milestones._ | | Always add a space before and after dashes when using it in a sentence (for replacing a comma, for example). | _You should try this - or not._ | | Always use lowercase after a colon. | _Related Issues: a way to create a relationship between issues._ | @@ -439,7 +445,7 @@ cp - Always start list items with a capital letter, unless they are parameters or commands that are in backticks, or similar. - Always leave a blank line before and after a list. -- Begin a line with spaces (not tabs) to denote a [nested subitem](#nesting-inside-a-list-item). +- Begin a line with spaces (not tabs) to denote a [nested sub-item](#nesting-inside-a-list-item). ### Ordered vs. unordered lists @@ -599,7 +605,7 @@ that is best described by a matrix, tables are the best choice for use. ### Creation guidelines -Due to accessibility and scanability requirements, tables should not have any +Due to accessibility and scannability requirements, tables should not have any empty cells. If there is no otherwise meaningful value for a cell, consider entering *N/A* (for 'not applicable') or *none*. @@ -648,7 +654,7 @@ For other punctuation rules, please refer to the links shift too, which eventually leads to dead links. If you think it is compelling to add numbers in headings, make sure to at least discuss it with someone in the Merge Request. -- [Avoid using symbols and special chars](https://gitlab.com/gitlab-org/gitlab-docs/issues/84) +- [Avoid using symbols and special characters](https://gitlab.com/gitlab-org/gitlab-docs/issues/84) in headers. Whenever possible, they should be plain and short text. - Avoid adding things that show ephemeral statuses. For example, if a feature is considered beta or experimental, put this information in a note, not in the heading. diff --git a/doc/development/testing_guide/frontend_testing.md b/doc/development/testing_guide/frontend_testing.md index 428532337c5..37e1066e7aa 100644 --- a/doc/development/testing_guide/frontend_testing.md +++ b/doc/development/testing_guide/frontend_testing.md @@ -26,7 +26,7 @@ Jest tests can be found in `/spec/frontend` and `/ee/spec/frontend` in EE. > **Note:** > -> Most examples have a Jest and Karma example. See the Karma examples only as explanation to what's going on in the code, should you stumble over some usescases during your discovery. The Jest examples are the one you should follow. +> Most examples have a Jest and Karma example. See the Karma examples only as explanation to what's going on in the code, should you stumble over some use cases during your discovery. The Jest examples are the one you should follow. ## Karma test suite @@ -61,7 +61,7 @@ which could arise (especially with testing against browser specific features). - Jest runs in a Node.js environment, not in a browser. Support for running Jest tests in a browser [is planned](https://gitlab.com/gitlab-org/gitlab/-/issues/26982). - Because Jest runs in a Node.js environment, it uses [jsdom](https://github.com/jsdom/jsdom) by default. See also its [limitations](#limitations-of-jsdom) below. - Jest does not have access to Webpack loaders or aliases. - The aliases used by Jest are defined in its [own config](https://gitlab.com/gitlab-org/gitlab/blob/master/jest.config.js). + The aliases used by Jest are defined in its [own configuration](https://gitlab.com/gitlab-org/gitlab/blob/master/jest.config.js). - All calls to `setTimeout` and `setInterval` are mocked away. See also [Jest Timer Mocks](https://jestjs.io/docs/en/timer-mocks). - `rewire` is not required because Jest supports mocking modules. See also [Manual Mocks](https://jestjs.io/docs/en/manual-mocks). - No [context object](https://jasmine.github.io/tutorials/your_first_suite#section-The_%3Ccode%3Ethis%3C/code%3E_keyword) is passed to tests in Jest. @@ -200,7 +200,7 @@ For example, it's better to use the generated markup to trigger a button click a ## Common practices -Following you'll find some general common practices you will find as part of our testsuite. Should you stumble over something not following this guide, ideally fix it right away. 🎉 +Following you'll find some general common practices you will find as part of our test suite. Should you stumble over something not following this guide, ideally fix it right away. 🎉 ### How to query DOM elements @@ -562,7 +562,7 @@ The more challenging part are mocks, which can be used for functions or even dep ### Manual module mocks Manual mocks are used to mock modules across the entire Jest environment. This is a very powerful testing tool that helps simplify -unit testing by mocking out modules which cannot be easily consumned in our test environment. +unit testing by mocking out modules which cannot be easily consumed in our test environment. > **WARNING:** Do not use manual mocks if a mock should not be consistently applied in every spec (i.e. it's only needed by a few specs). > Instead, consider using [`jest.mock(..)`](https://jestjs.io/docs/en/jest-object#jestmockmodulename-factory-options) @@ -588,10 +588,10 @@ If a manual mock is needed for a CE module, please place it in `spec/frontend/mo - [`mocks/axios_utils`](https://gitlab.com/gitlab-org/gitlab/blob/bd20aeb64c4eed117831556c54b40ff4aee9bfd1/spec/frontend/mocks/ce/lib/utils/axios_utils.js#L1) - This mock is helpful because we don't want any unmocked requests to pass any tests. Also, we are able to inject some test helpers such as `axios.waitForAll`. - [`__mocks__/mousetrap/index.js`](https://gitlab.com/gitlab-org/gitlab/blob/cd4c086d894226445be9d18294a060ba46572435/spec/frontend/__mocks__/mousetrap/index.js#L1) - - This mock is helpful because the module itself uses amd format which webpack understands, but is incompatible with the jest environment. This mock doesn't remove + This mock is helpful because the module itself uses AMD format which webpack understands, but is incompatible with the jest environment. This mock doesn't remove any behavior, only provides a nice es6 compatible wrapper. - [`__mocks__/monaco-editor/index.js`](https://gitlab.com/gitlab-org/gitlab/blob/b7f914cddec9fc5971238cdf12766e79fa1629d7/spec/frontend/__mocks__/monaco-editor/index.js) - - This mock is helpful because the monaco package is completely incompatible in a Jest environment. In fact, webpack requires a special loader to make it work. This mock + This mock is helpful because the Monaco package is completely incompatible in a Jest environment. In fact, webpack requires a special loader to make it work. This mock simply makes this package consumable by Jest. ### Keep mocks light @@ -617,7 +617,7 @@ As long as the fixtures don't change, `yarn test` is sufficient (and saves you s ### Live testing and focused testing -- Jest -While you work on a testsuite, you may want to run these specs in watch mode, so they rerun automatically on every save. +While you work on a test suite, you may want to run these specs in watch mode, so they rerun automatically on every save. ```shell # Watch and rerun all specs matching the name icon @@ -836,11 +836,11 @@ testAction( ); ``` -Check an example in [spec/javascripts/ide/stores/actions_spec.jsspec/javascripts/ide/stores/actions_spec.js](https://gitlab.com/gitlab-org/gitlab/blob/master/spec/javascripts/ide/stores/actions_spec.js). +Check an example in [`spec/javascripts/ide/stores/actions_spec.jsspec/javascripts/ide/stores/actions_spec.js`](https://gitlab.com/gitlab-org/gitlab/blob/master/spec/javascripts/ide/stores/actions_spec.js). -### Wait until axios requests finish +### Wait until Axios requests finish -The axios utils mock module located in `spec/frontend/mocks/ce/lib/utils/axios_utils.js` contains two helper methods for Jest tests that spawn HTTP requests. +The Axios Utils mock module located in `spec/frontend/mocks/ce/lib/utils/axios_utils.js` contains two helper methods for Jest tests that spawn HTTP requests. These are very useful if you don't have a handle to the request's Promise, for example when a Vue component does a request as part of its life cycle. - `waitFor(url, callback)`: Runs `callback` after a request to `url` finishes (either successfully or unsuccessfully). @@ -850,11 +850,11 @@ Both functions run `callback` on the next tick after the requests finish (using ## Testing with older browsers -Some regressions only affect a specific browser version. We can install and test in particular browsers with either Firefox or Browserstack using the following steps: +Some regressions only affect a specific browser version. We can install and test in particular browsers with either Firefox or BrowserStack using the following steps: -### Browserstack +### BrowserStack -[Browserstack](https://www.browserstack.com/) allows you to test more than 1200 mobile devices and browsers. +[BrowserStack](https://www.browserstack.com/) allows you to test more than 1200 mobile devices and browsers. You can use it directly through the [live app](https://www.browserstack.com/live) or you can install the [chrome extension](https://chrome.google.com/webstore/detail/browserstack/nkihdmlheodkdfojglpcjjmioefjahjb) for easy access. You can find the credentials on 1Password, under `frontendteam@gitlab.com`. @@ -866,7 +866,7 @@ You can download any older version of Firefox from the releases FTP server, Operations > Status Page**. +1. To view the [Operations Settings](../settings/#operations-settings) page, navigate to **{settings}** **Settings > Operations > Status Page**. 1. Fill in your cloud provider's credentials and make sure the **Active** checkbox is checked. 1. Click **Save changes**. diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 904acc7241b..c9d9d346446 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -5709,6 +5709,9 @@ msgstr "" msgid "ComplianceFramework|This project is regulated by %{framework}." msgstr "" +msgid "Confidence" +msgstr "" + msgid "Confidence: %{confidence}" msgstr "" @@ -13712,6 +13715,9 @@ msgstr "" msgid "Metrics::Dashboard::Annotation|You are not authorized to delete this annotation" msgstr "" +msgid "Metrics::Dashboard::Annotation|can't be before starting_at time" +msgstr "" + msgid "Metrics::UsersStarredDashboards|Dashboard with requested path can not be found" msgstr "" @@ -15487,6 +15493,9 @@ msgstr "" msgid "Paste your public SSH key, which is usually contained in the file '~/.ssh/id_ed25519.pub' or '~/.ssh/id_rsa.pub' and begins with 'ssh-ed25519' or 'ssh-rsa'. Don't use your private SSH key." msgstr "" +msgid "Patch to apply" +msgstr "" + msgid "Path" msgstr "" @@ -17933,6 +17942,9 @@ msgstr "" msgid "Remediated: needs review" msgstr "" +msgid "Remediations" +msgstr "" + msgid "Remember me" msgstr "" @@ -19842,6 +19854,9 @@ msgstr "" msgid "Settings to prevent self-approval across all projects in the instance. Only an administrator can modify these settings." msgstr "" +msgid "Severity" +msgstr "" + msgid "Severity: %{severity}" msgstr "" @@ -20174,6 +20189,9 @@ msgstr "" msgid "Snowplow" msgstr "" +msgid "Solution" +msgstr "" + msgid "Some child epics may be hidden due to applied filters" msgstr "" diff --git a/package.json b/package.json index fb058ed0ea4..ffe6cd5779e 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "@gitlab/svgs": "1.130.0", "@gitlab/ui": "16.0.0", "@gitlab/visual-review-tools": "1.6.1", - "@rails/actioncable": "^6.0.3", + "@rails/actioncable": "^6.0.3-1", "@sentry/browser": "^5.10.2", "@sourcegraph/code-host-integration": "0.0.47", "@toast-ui/editor": "^2.0.1", diff --git a/qa/Gemfile b/qa/Gemfile index 6eb8733ab41..d5c682ef76f 100644 --- a/qa/Gemfile +++ b/qa/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' gem 'gitlab-qa' -gem 'activesupport', '~> 6.0.3' # This should stay in sync with the root's Gemfile +gem 'activesupport', '~> 6.0.3.1' # This should stay in sync with the root's Gemfile gem 'capybara', '~> 3.29.0' gem 'capybara-screenshot', '~> 1.0.23' gem 'rake', '~> 12.3.0' diff --git a/qa/Gemfile.lock b/qa/Gemfile.lock index 9aeba236c96..23324fccdec 100644 --- a/qa/Gemfile.lock +++ b/qa/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - activesupport (6.0.3) + activesupport (6.0.3.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -54,7 +54,7 @@ GEM mime-types-data (3.2020.0425) mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.14.0) + minitest (5.14.1) netrc (0.11.0) nokogiri (1.10.9) mini_portile2 (~> 2.4.0) @@ -116,7 +116,7 @@ PLATFORMS ruby DEPENDENCIES - activesupport (~> 6.0.3) + activesupport (~> 6.0.3.1) airborne (~> 0.3.4) capybara (~> 3.29.0) capybara-screenshot (~> 1.0.23) diff --git a/spec/models/metrics/dashboard/annotation_spec.rb b/spec/models/metrics/dashboard/annotation_spec.rb index f7fd7ded7e6..3cba31ffdfe 100644 --- a/spec/models/metrics/dashboard/annotation_spec.rb +++ b/spec/models/metrics/dashboard/annotation_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' describe Metrics::Dashboard::Annotation do + using RSpec::Parameterized::TableSyntax + describe 'associations' do it { is_expected.to belong_to(:environment).inverse_of(:metrics_dashboard_annotations) } it { is_expected.to belong_to(:cluster).class_name('Clusters::Cluster').inverse_of(:metrics_dashboard_annotations) } @@ -28,6 +30,26 @@ describe Metrics::Dashboard::Annotation do end end + context 'ending_at_after_starting_at' do + where(:starting_at, :ending_at, :valid?, :message) do + 2.days.ago.beginning_of_day | 1.day.ago.beginning_of_day | true | nil + 1.day.ago.beginning_of_day | nil | true | nil + 1.day.ago.beginning_of_day | 1.day.ago.beginning_of_day | true | nil + 1.day.ago.beginning_of_day | 2.days.ago.beginning_of_day | false | /Ending at can't be before starting_at time/ + nil | 2.days.ago.beginning_of_day | false | /Starting at can't be blank/ # validation is covered by other method, be we need to assure, that ending_at_after_starting_at will not break with nil as starting_at + nil | nil | false | /Starting at can't be blank/ # validation is covered by other method, be we need to assure, that ending_at_after_starting_at will not break with nil as starting_at + end + + with_them do + subject(:annotation) { build(:metrics_dashboard_annotation, starting_at: starting_at, ending_at: ending_at) } + + it do + expect(annotation.valid?).to be(valid?) + expect(annotation.errors.full_messages).to include(message) if message + end + end + end + context 'environments annotation' do subject { build(:metrics_dashboard_annotation) } @@ -75,5 +97,16 @@ describe Metrics::Dashboard::Annotation do expect(described_class.for_dashboard('other_dashboard.yml')).to match_array [other_dashboard_annotation] end end + + describe '#ending_before' do + it 'returns annotations only for appointed dashboard' do + Timecop.freeze do + twelve_minutes_old_annotation = create(:metrics_dashboard_annotation, starting_at: 15.minutes.ago, ending_at: 12.minutes.ago) + create(:metrics_dashboard_annotation, starting_at: 15.minutes.ago, ending_at: 11.minutes.ago) + + expect(described_class.ending_before(11.minutes.ago)).to match_array [fifteen_minutes_old_annotation, twelve_minutes_old_annotation] + end + end + end end end diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index 0818bab6bc2..1bf2c0c533a 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -465,19 +465,6 @@ describe API::Users, :do_not_mock_admin_mode do expect(response).to have_gitlab_http_status(:bad_request) end end - - context "when authenticated and ldap is enabled" do - it "returns non-ldap user" do - ldap_user = create :omniauth_user, provider: "ldapserver1" - - get api("/users", user), params: { skip_ldap: "true" } - - expect(response).to have_gitlab_http_status(:ok) - expect(json_response).to be_an Array - expect(json_response.map { |u| u['username'] }) - .not_to include(ldap_user.username) - end - end end describe "GET /users/:id" do diff --git a/yarn.lock b/yarn.lock index fbef3987222..687b9cc49ef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -983,10 +983,10 @@ consola "^2.10.1" node-fetch "^2.6.0" -"@rails/actioncable@^6.0.3": - version "6.0.3" - resolved "https://registry.yarnpkg.com/@rails/actioncable/-/actioncable-6.0.3.tgz#722b4b639936129307ddbab3a390f6bcacf3e7bc" - integrity sha512-I01hgqxxnOgOtJTGlq0ZsGJYiTEEiSGVEGQn3vimZSqEP1HqzyFNbzGTq14Xdyeow2yGJjygjoFF1pmtE+SQaw== +"@rails/actioncable@^6.0.3-1": + version "6.0.3-1" + resolved "https://registry.yarnpkg.com/@rails/actioncable/-/actioncable-6.0.3-1.tgz#9b9eb8858a6507162911007d355d9a206e1c5caa" + integrity sha512-szFhWD+V5TAxVNVIG16klgq+ypqA5k5AecLarTTrXgOG8cawVbQdOAwLbCmzkwiQ60rGSxAFoC1u2LrzxSK2Aw== "@sentry/browser@^5.10.2": version "5.10.2"