bump jest and fix integration test (#55)

This commit is contained in:
David Gamero 2022-06-21 08:54:22 -04:00 коммит произвёл GitHub
Родитель 09392910a9
Коммит d893f27da9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 226 добавлений и 2787 удалений

10
.github/workflows/integration-tests.yml поставляемый
Просмотреть файл

@ -3,11 +3,11 @@ on: # rebuild any PRs and main branch changes
pull_request:
branches:
- main
- 'releases/*'
- "releases/*"
push:
branches:
- main
- 'releases/*'
- "releases/*"
jobs:
run-integration-test:
@ -32,18 +32,18 @@ jobs:
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.x'
python-version: "3.x"
- name: Install requests library
run: pip install requests
- name: Validate kubectl setup
run: python test/validate-kubectl.py latest
run: python test/validate-kubectl.py !v1.15.1
- name: Setup kubectl
uses: ./
with:
version: 'v1.15.1'
version: "v1.15.1"
- name: Validate kubectl setup
run: python test/validate-kubectl.py 'v1.15.1'

2907
package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -24,8 +24,8 @@
"@types/node": "^12.0.4",
"@vercel/ncc": "^0.33.1",
"jest": "^26.0.1",
"@types/jest": "^25.2.2",
"ts-jest": "^25.5.1",
"@types/jest": "^26.0.1",
"ts-jest": "^26.0.1",
"typescript": "3.9.2"
}
}

Просмотреть файл

@ -1,31 +1,65 @@
import os, sys, json, requests, time
import os
import sys
import json
import requests
import time
version_to_check = sys.argv[1]
version_info = None
PASSED = False
try:
print('kubectl version --client -o json')
version_info = json.load(os.popen('kubectl version --client -o json'))
except Exception as ex:
sys.exit('kubectl not installed')
try:
if version_to_check == 'latest':
def get_latest_version():
response = None
time_to_sleep = 2
for _ in range(10):
response = requests.get('https://storage.googleapis.com/kubernetes-release/release/stable.txt')
response = requests.get(
'https://storage.googleapis.com/kubernetes-release/release/stable.txt')
if response.status_code == 200:
break
print('Failed to obtain latest version info, retrying.')
time.sleep(time_to_sleep)
time_to_sleep *= 2
version_to_check = response.content.decode('utf-8')
PASSED = True if version_info['clientVersion']['gitVersion'] == version_to_check else False
except:
return response.content.decode('utf-8')
version_arg = sys.argv[1]
installed_version_info = None
PASSED = True
try:
print('kubectl version --client -o json')
installed_version_info = json.load(
os.popen('kubectl version --client -o json'))
print(
f'installed version: {installed_version_info["clientVersion"]["gitVersion"]}')
except Exception as ex:
sys.exit('kubectl not installed')
try:
installed_version = installed_version_info['clientVersion']['gitVersion']
# NOT Match
if version_arg[0] == '!':
undesired_version = version_arg[1:]
print(f'undesired version: {undesired_version}')
if installed_version == undesired_version:
print(
f'installed version ({installed_version}) matches undesire {undesired_version} - FAIL')
PASSED = False
# Exact Match
else:
if version_arg == 'latest':
print('checking latest version')
desired_version = get_latest_version()
else:
desired_version = version_arg
print(f'desired version: {desired_version}')
if installed_version != desired_version:
print(
f'installed version ({installed_version}) does not match desired ({desired_version}) - FAIL')
PASSED = False
except Exception as ex:
print(f'Exception: {ex}')
pass
if not PASSED:
sys.exit('Setting up of '+version_to_check+' kubectl failed')
sys.exit('Setting up of '+version_arg+' kubectl failed')
print('Test passed')
sys.exit()