Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.x] Unit Test Coverage Threshold (#101) #123

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
e09b77e
updating version to 2.5.0
macohen Oct 31, 2022
f4e3e74
Merge pull request #29 from macohen/2.x
macohen Nov 1, 2022
9393497
fixing badly merged README.md
macohen Oct 31, 2022
5f05a54
feat: Add layout mock
Oct 27, 2022
8c1fad3
feat: Add flyout
Oct 27, 2022
688c8d5
feat: Add results rank comparison
Oct 27, 2022
d0bf544
feat: Add error handler
Oct 28, 2022
3ba4408
Polish styles
Oct 28, 2022
36be4ef
Fix results row height
Oct 31, 2022
05fd3f8
fix: Font family
Oct 31, 2022
a2685aa
Fix results row height
Oct 31, 2022
ebd47ab
feat: Add href to links
Oct 31, 2022
e6f56a5
feat: Finalize help content
Oct 31, 2022
480b535
fix: Error handler for results display
Oct 31, 2022
4f0221b
feat: Add formatted query error message
Oct 31, 2022
15a81fe
fix: Display arrays or nest value
Oct 31, 2022
76cef49
fix: Add period at the end
Oct 31, 2022
88898e3
fix: Add wrapping curly braces
Oct 31, 2022
1e1e35e
fix: Change SearchText to SearchText
Oct 31, 2022
66478e8
fix: Center Add queries to compare search results.
Oct 31, 2022
a8a722d
fix: Update invalid query error message
Oct 31, 2022
2e60a07
updating version to 2.5.0
macohen Oct 31, 2022
b461d42
Merge pull request #30 from mingkunm/feature/integration-test
macohen Nov 1, 2022
a2cf65c
Merge pull request #31 from macohen/2.x
macohen Nov 1, 2022
6f0541a
Moving PULL_REQUEST_TEMPLATE.md to .github dir (#35) (#36)
github-actions[bot] Nov 1, 2022
1c8eabf
Add windows-latest back to test-and-build workflow (#39) (#40)
github-actions[bot] Nov 1, 2022
acf2e31
Add codeowner (#43) (#44)
github-actions[bot] Nov 1, 2022
17823b8
Make srdash compatible with default build script (#46) (#48)
github-actions[bot] Nov 1, 2022
cd6fd8e
Add whitesource configuration (#49) (#51)
github-actions[bot] Nov 1, 2022
dc7509d
feat: Change results number to displayed number (#55) (#56)
github-actions[bot] Nov 2, 2022
bdc0287
Fix backport delete action; Adding Badges for Build and Link Checker…
github-actions[bot] Nov 3, 2022
efe0e92
release notes for 2.4.0 (#65) (#66)
github-actions[bot] Nov 4, 2022
6f3bb0f
Remove beta1 (#70) (#72)
github-actions[bot] Nov 5, 2022
f9d31b2
Update the release notes folder name for consistency (#73) (#74)
github-actions[bot] Nov 5, 2022
a04d5f3
Fix styling conflicts (#59) (#79)
github-actions[bot] Nov 7, 2022
7eaec03
Fix default tab spacing (#77) (#80)
github-actions[bot] Nov 8, 2022
9d36f55
Fix "See some examples" requires non-empty query [BUG] (#82) (#85)
github-actions[bot] Nov 8, 2022
a317487
Unit test (#83) (#86)
github-actions[bot] Nov 8, 2022
f63aa91
Unit test (#88) (#89)
github-actions[bot] Nov 9, 2022
92d693f
codecov badge; edited documentation in README (#91) (#92)
github-actions[bot] Nov 9, 2022
5f88f26
Fix result text issue (#94) (#95)
github-actions[bot] Nov 11, 2022
b2b172e
renamed files with typos from serach* to search* (#97) (#99)
github-actions[bot] Nov 14, 2022
9379c49
Updating 2.x test-and-build.yml to build version 2.5.0.0 (#64)
macohen Dec 12, 2022
d62c912
Updated MAINTAINERS.md to match recommended opensearch-project format…
github-actions[bot] Jan 6, 2023
496d124
Resolve to newer versions of dependencies (#107) (#115)
github-actions[bot] Jan 9, 2023
09236bf
Update yarn.lock (#113) (#120)
github-actions[bot] Jan 9, 2023
83318cb
Unit Test Coverage Threshold (#101)
macohen Dec 8, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": { "node": "10" }
}
],
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": [
"@babel/plugin-transform-modules-commonjs",
["@babel/plugin-transform-runtime", { "regenerator": true }],
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread"
]
}
16 changes: 16 additions & 0 deletions .cypress/integration/1_query_compare.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

/// <reference types="cypress" />
import {
landOnSearchRelevance,
} from '../utils/event_constants';

describe('Search a query', () => {
it('Should get search bar', () => {
landOnSearchRelevance();
cy.get('input[type="search"]').should('exist')
});
});
26 changes: 26 additions & 0 deletions .cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

/**
* @type {Cypress.PluginConfig}
*/
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
71 changes: 71 additions & 0 deletions .cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

const { ADMIN_AUTH } = require('./constants');

Cypress.Commands.overwrite('visit', (originalFn, url, options) => {
// Add the basic auth header when security enabled in the OpenSearch cluster
// https://github.com/cypress-io/cypress/issues/1288
if (Cypress.env('security_enabled')) {
if (options) {
options.auth = ADMIN_AUTH;
} else {
options = { auth: ADMIN_AUTH };
}
// Add query parameters - select the default OpenSearch Dashboards tenant
options.qs = { security_tenant: 'private' };
return originalFn(url, options);
} else {
return originalFn(url, options);
}
});

// Be able to add default options to cy.request(), https://github.com/cypress-io/cypress/issues/726
Cypress.Commands.overwrite('request', (originalFn, ...args) => {
let defaults = {};
// Add the basic authentication header when security enabled in the OpenSearch cluster
if (Cypress.env('security_enabled')) {
defaults.auth = ADMIN_AUTH;
}

let options = {};
if (typeof args[0] === 'object' && args[0] !== null) {
options = Object.assign({}, args[0]);
} else if (args.length === 1) {
[options.url] = args;
} else if (args.length === 2) {
[options.method, options.url] = args;
} else if (args.length === 3) {
[options.method, options.url, options.body] = args;
}

return originalFn(Object.assign({}, defaults, options));
});
9 changes: 9 additions & 0 deletions .cypress/support/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

export const ADMIN_AUTH = {
username: 'admin',
password: 'admin',
};
30 changes: 30 additions & 0 deletions .cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands';

// Alternatively you can use CommonJS syntax:
// require('./commands')

// Switch the base URL of OpenSearch when security enabled in the cluster
if (Cypress.env('security_enabled')) {
Cypress.env('opensearch', 'https://localhost:9200');
}
8 changes: 8 additions & 0 deletions .cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"allowJs": true,
"baseUrl": "../node_modules",
"types": ["cypress"]
},
"include": ["**/*.*"]
}
8 changes: 8 additions & 0 deletions .cypress/utils/event_constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const delay = 1000;

export const landOnSearchRelevance = () => {
cy.visit(
`${Cypress.env('opensearchDashboards')}/app/searchRelevance#/`
);
cy.wait(delay);
};
8 changes: 8 additions & 0 deletions .github/.codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# https://docs.codecov.com/docs/codecov-yaml
coverage:
status:
project:
default:
target: 80%%
threshold: 2%

2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This should match the owning team set up in https://github.com/orgs/opensearch-project/teams
* @opensearch-project/search-relevance-dashboards-team
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/delete-backport-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
delete-branch:
runs-on: ubuntu-latest
if: startsWith(github.event.pull_request.head.ref,'backport/')
if: startsWith(github.event.pull_request.head.ref,'backport-')
steps:
- name: Delete merged branch
uses: SvanBoxel/delete-merged-branch@main
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/draft-release-notes-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release Drafter

on:
push:
branches:
- main

jobs:
update_release_draft:
name: Update draft release notes
runs-on: ubuntu-latest
steps:
- name: Update draft release notes
uses: release-drafter/release-drafter@v5
with:
config-name: draft-release-notes-config.yml
name: Version (set here)
tag: (None)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/link-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: lychee Link Checker
id: lychee
uses: lycheeverse/lychee-action@master
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/stats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Pull Request Stats

on:
pull_request:
types: [opened]
workflow_dispatch:

jobs:
stats:
runs-on: ubuntu-latest
steps:
- name: Run pull request stats
uses: flowwer-dev/pull-request-stats@master
14 changes: 7 additions & 7 deletions .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ on: [pull_request, push]

env:
PLUGIN_NAME: dashboards-search-relevance
OPENSEARCH_VERSION: "main"
OPENSEARCH_PLUGIN_VERSION: 3.0.0.0
OPENSEARCH_VERSION: '2.x'
OPENSEARCH_PLUGIN_VERSION: 2.5.0.0

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- name: Check LongPathsEnabled
- name: Enable core.longpaths on Windows
if: ${{ matrix.os == 'windows-latest' }}
run: (Get-ItemProperty "HKLM:System\CurrentControlSet\Control\FileSystem").LongPathsEnabled
run: git config --global core.longpaths true

- name: Checkout Dashboards Search Relevance plugin
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: dashboards-search-relevance

- name: Checkout OpenSearch Dashboards
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: opensearch-project/OpenSearch-Dashboards
ref: ${{ env.OPENSEARCH_VERSION }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ build/
coverage/
.cypress/screenshots
.cypress/videos
yarn-error.log
23 changes: 23 additions & 0 deletions .whitesource
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"scanSettings": {
"configMode": "AUTO",
"configExternalURL": "",
"projectToken": "",
"baseBranches": []
},
"checkRunSettings": {
"vulnerableCheckRunConclusionLevel": "failure",
"displayMode": "diff",
"useMendCheckNames": true
},
"issueSettings": {
"minSeverityLevel": "LOW",
"issueType": "DEPENDENCY"
},
"remediateSettings": {
"workflowRules": {
"enabled": true
}
}
}

Loading