Skip to content

Commit

Permalink
GitHub workflow file. (#35)
Browse files Browse the repository at this point in the history
* GitHub workflow file.

Signed-off-by: Sophia Garg <[email protected]>

* Modifications in CI workflow file.

Signed-off-by: Sophia Garg <[email protected]>

* Driver-code and test-case for Ping API is added.

Signed-off-by: Sophia Garg <[email protected]>

* New-lines added.

Signed-off-by: Sophia Garg <[email protected]>

* Table added in driver-code for displaying failed result, added comments in ci workflow file and new-line added in ping model test-case.

Signed-off-by: Sophia Garg <[email protected]>

* command for installing Pretty-table module in python is added.

Signed-off-by: Sophia Garg <[email protected]>

* Added code for displaying count of test-cases passed/failed.

Signed-off-by: Sophia Garg <[email protected]>

* Adding pipfile, pipfile.lock for python modules , package.json and package-lock.json for node modules and script folder added for all script files.

Signed-off-by: Sophia Garg <[email protected]>

* Updating CI workflow file.

Signed-off-by: Sophia Garg <[email protected]>

* updating python_version to wildcard.

Signed-off-by: Sophia Garg <[email protected]>

* Separate file created for shell script.

Signed-off-by: Sophia Garg <[email protected]>

* Removal of extra character in a file.

Signed-off-by: Sophia Garg <[email protected]>

Co-authored-by: Sophia Garg <[email protected]>
  • Loading branch information
SOPHIA2401 and Sophia Garg authored Jun 3, 2022
1 parent 04c24da commit a95097a
Show file tree
Hide file tree
Showing 10 changed files with 469 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI

on: [push, pull_request]

jobs:
run_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2

- name: Installing node modules
run: npm install
working-directory: ./test

- name: Installing Dredd
run: sudo npm install dredd --global --unsafe-perm=true --allow-root

- name: Set up Python
uses: actions/setup-python@v2

- name: Install pipenv
run: pip install pipenv

- name: Installing python modules
run: pipenv install --system
working-directory: ./test

- name: Build the stack
run: docker-compose up -d
shell: bash
working-directory: ./test

- name: Waiting for OpenSearch domain to be up.
run: sh ./.github/workflows/domain-check.sh

- name: Run script file
run: |
# Disabling TLS certificate verfication as hosted on docker.
export NODE_TLS_REJECT_UNAUTHORIZED=0
python driver-code.py
shell: bash
working-directory: ./test/scripts

17 changes: 17 additions & 0 deletions .github/workflows/domain-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
counter=1
for counter in {1..10}
do
if [ $(curl -s -o /dev/null --head -w "%{http_code}" 'https://admin:admin@localhost:9200' -H 'Content-Type:application/json' --insecure -v) -ne 200 ]; then
sleep 30s
else
# Waiting for security plugin to be initialised and become operational.
echo "Waiting for addtional 30 seconds.. for Opensearch domain to be up."
sleep 30s
break
fi
done
if [ $counter -eq 11 ]; then
echo "Unable to connect with OpenSearch URL https://localhost:9200/"
exit 1
fi

12 changes: 12 additions & 0 deletions test/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
prettytable = "*"

[dev-packages]

[requires]
python_version = "*"
36 changes: 36 additions & 0 deletions test/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions test/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
version: '3'
services:
opensearch-node1:
image: opensearchproject/opensearch:latest
container_name: opensearch-node1
environment:
- cluster.name=opensearch-cluster
- node.name=opensearch-node1
- discovery.seed_hosts=opensearch-node1,opensearch-node2
- cluster.initial_master_nodes=opensearch-node1,opensearch-node2
- bootstrap.memory_lock=true # along with the memlock settings below, disables swapping
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" # minimum and maximum Java heap size, recommend setting both to 50% of system RAM
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536 # maximum number of open files for the OpenSearch user, set to at least 65536 on modern systems
hard: 65536
volumes:
- opensearch-data1:/usr/share/opensearch/data
ports:
- 9200:9200
- 9600:9600 # required for Performance Analyzer
networks:
- opensearch-net

opensearch-node2:
image: opensearchproject/opensearch:latest
container_name: opensearch-node2
environment:
- cluster.name=opensearch-cluster
- node.name=opensearch-node2
- discovery.seed_hosts=opensearch-node1,opensearch-node2
- cluster.initial_master_nodes=opensearch-node1,opensearch-node2
- bootstrap.memory_lock=true
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
volumes:
- opensearch-data2:/usr/share/opensearch/data
networks:
- opensearch-net

volumes:
opensearch-data1:
opensearch-data2:

networks:
opensearch-net:

55 changes: 55 additions & 0 deletions test/models/_global/ping/OpenSearchModel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
openapi: 3.0.2
info:
title: OpenSearch
version: '2021-11-23'
paths:
/:
get:
description: Returns whether the cluster is running.
operationId: GetPingCluster
responses:
'200':
description: GetPingCluster 200 response
content:
application/json:
schema:
$ref: '#/components/schemas/GetPingClusterResponseContent'
components:
schemas:
GetPingClusterResponseContent:
type: object
properties:
name:
type: string
cluster_name:
type: string
cluster_uuid:
type: string
version:
$ref: '#/components/schemas/intermediateStructure'
tagline:
type: string
intermediateStructure:
type: object
properties:
distribution:
type: string
number:
type: string
build_type:
type: string
build_hash:
type: string
build_date:
type: string
build_snapshot:
type: boolean
nullable: true
lucene_version:
type: string
minimum_wire_compatibility_version:
type: string
minimum_index_compatibility_version:
type: string


7 changes: 7 additions & 0 deletions test/models/_global/ping/hooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const hooks = require('hooks');

hooks.before("/ > GET > 200 > application/json",function(transactions,done){
transactions.expected.headers['Content-Type'] = "application/json; charset=UTF-8";
done();
});

119 changes: 119 additions & 0 deletions test/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "test-modules",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"fs": "^0.0.1-security",
"hooks": "^0.3.2",
"https": "^1.0.0",
"node-fetch": "^2.6.7"
}
}
Loading

0 comments on commit a95097a

Please sign in to comment.