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

Update group_test.py #395

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions .github/ci_templates/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,16 @@ steps:
docker run {!{ $run.docker_options }!} ${TESTS_IMAGE_NAME} {!{ $run.args }!}
# </template: tests_before_build_template>
{!{- end -}!}

{!{ define "tests_webhooks_template" }!}
# <template: tests_webhooks_template>
{!{- $ctx := index . 0 }!}
runs-on: [self-hosted, regular]
steps:
{!{ tmpl.Exec "started_at_output" $ctx | strings.Indent 2 }!}
{!{ tmpl.Exec "checkout_full_step" $ctx | strings.Indent 2 }!}
- name: Run python webhook tests
run: |
make tests-webhooks
# </template: tests_webhooks_template>
{!{- end -}!}
8 changes: 8 additions & 0 deletions .github/workflow_templates/build-and-test_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ jobs:
- pull_request_info
{!{ tmpl.Exec "tests_before_build_template" (slice $ctx "unit") | strings.Indent 4 }!}

tests_python_webhooks:
if: ${{ needs.pull_request_info.outputs.changes_not_markdown == 'true' }}
name: Tests python webhooks
needs:
- git_info
- pull_request_info
{!{ tmpl.Exec "tests_webhooks_template" (slice $ctx) | strings.Indent 4 }!}

matrix_tests:
if: ${{ needs.pull_request_info.outputs.changes_not_markdown == 'true' }}
name: Matrix tests
Expand Down
6 changes: 6 additions & 0 deletions .github/workflow_templates/build-and-test_pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ jobs:
- git_info
{!{ tmpl.Exec "tests_before_build_template" (slice $ctx "unit") | strings.Indent 4 }!}

tests_python_webhooks:
name: Tests python webhooks
needs:
- git_info
{!{ tmpl.Exec "tests_webhooks_template" (slice $ctx) | strings.Indent 4 }!}

matrix_tests:
name: Matrix tests
needs:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflow_templates/build-and-test_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ jobs:
{!{ tmpl.Exec "tests_before_build_template" (slice $ctx "unit") | strings.Indent 4 }!}
{!{ tmpl.Exec "update_comment_on_finish" (slice "job,one-line" $jobNames.tests) | strings.Indent 6 }!}

{!{ $jobNames = coll.Merge $jobNames (dict "tests_python_webhooks" "Tests python webhooks") }!}
tests_python_webhooks:
name: {!{ $jobNames.tests_python_webhooks }!}
needs:
- git_info
{!{ tmpl.Exec "tests_webhooks_template" (slice $ctx) | strings.Indent 4 }!}
{!{ tmpl.Exec "update_comment_on_finish" (slice "job,one-line" $jobNames.tests_python_webhooks) | strings.Indent 6 }!}

{!{ $jobNames = coll.Merge $jobNames (dict "matrix_tests" "Matrix tests") }!}
matrix_tests:
name: {!{ $jobNames.matrix_tests }!}
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/build-and-test_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,37 @@ jobs:
docker run -w /deckhouse -v ${{github.workspace}}:/deckhouse -e "TERM=xterm-256color" -v ~/go-pkg-cache:/go/pkg ${TESTS_IMAGE_NAME} make tests-controller tests-modules
# </template: tests_before_build_template>

tests_python_webhooks:
if: ${{ needs.pull_request_info.outputs.changes_not_markdown == 'true' }}
name: Tests python webhooks
needs:
- git_info
- pull_request_info

# <template: tests_webhooks_template>
runs-on: [self-hosted, regular]
steps:

# <template: started_at_output>
- name: Job started timestamp
id: started_at
run: |
unixTimestamp=$(date +%s)
echo "started_at=${unixTimestamp}" >> $GITHUB_OUTPUT
# </template: started_at_output>

# <template: checkout_full_step>
- name: Checkout sources
uses: actions/[email protected]
with:
fetch-depth: 0
ref: ${{ needs.pull_request_info.outputs.ref }}
# </template: checkout_full_step>
- name: Run python webhook tests
run: |
make tests-webhooks
# </template: tests_webhooks_template>

matrix_tests:
if: ${{ needs.pull_request_info.outputs.changes_not_markdown == 'true' }}
name: Matrix tests
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/build-and-test_pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,34 @@ jobs:
docker run -w /deckhouse -v ${{github.workspace}}:/deckhouse -e "TERM=xterm-256color" -v ~/go-pkg-cache:/go/pkg ${TESTS_IMAGE_NAME} make tests-controller tests-modules
# </template: tests_before_build_template>

tests_python_webhooks:
name: Tests python webhooks
needs:
- git_info

# <template: tests_webhooks_template>
runs-on: [self-hosted, regular]
steps:

# <template: started_at_output>
- name: Job started timestamp
id: started_at
run: |
unixTimestamp=$(date +%s)
echo "started_at=${unixTimestamp}" >> $GITHUB_OUTPUT
# </template: started_at_output>

# <template: checkout_full_step>
- name: Checkout sources
uses: actions/[email protected]
with:
fetch-depth: 0
# </template: checkout_full_step>
- name: Run python webhook tests
run: |
make tests-webhooks
# </template: tests_webhooks_template>

matrix_tests:
name: Matrix tests
needs:
Expand Down
62 changes: 61 additions & 1 deletion .github/workflows/build-and-test_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2326,6 +2326,66 @@ jobs:
# </template: update_comment_on_finish>


tests_python_webhooks:
name: Tests python webhooks
needs:
- git_info

# <template: tests_webhooks_template>
runs-on: [self-hosted, regular]
steps:

# <template: started_at_output>
- name: Job started timestamp
id: started_at
run: |
unixTimestamp=$(date +%s)
echo "started_at=${unixTimestamp}" >> $GITHUB_OUTPUT
# </template: started_at_output>

# <template: checkout_full_step>
- name: Checkout sources
uses: actions/[email protected]
with:
fetch-depth: 0
# </template: checkout_full_step>
- name: Run python webhook tests
run: |
make tests-webhooks
# </template: tests_webhooks_template>
# <template: update_comment_on_finish>
- name: Update comment on finish
id: update_comment_on_finish
if: ${{ always() && github.event_name == 'workflow_dispatch' && !!github.event.inputs.issue_number }}
env:
NEEDS_CONTEXT: ${{ toJSON(needs) }}
JOB_CONTEXT: ${{ toJSON(job) }}
STEPS_CONTEXT: ${{ toJSON(steps) }}
uses: actions/[email protected]
with:
github-token: ${{secrets.BOATSWAIN_GITHUB_TOKEN}}
retries: 3
script: |
const statusConfig = 'job,one-line';
const name = 'Tests python webhooks';
const needsContext = JSON.parse(process.env.NEEDS_CONTEXT);
const jobContext = JSON.parse(process.env.JOB_CONTEXT);
const stepsContext = JSON.parse(process.env.STEPS_CONTEXT);
let jobNames = null
if (process.env.JOB_NAMES) {
jobNames = JSON.parse(process.env.JOB_NAMES);
}

core.info(`needsContext: ${JSON.stringify(needsContext)}`);
core.info(`jobContext: ${JSON.stringify(jobContext)}`);
core.info(`stepsContext: ${JSON.stringify(stepsContext)}`);
core.info(`jobNames: ${JSON.stringify(jobNames)}`);

const ci = require('./.github/scripts/js/ci');
return await ci.updateCommentOnFinish({github, context, core, statusConfig, name, needsContext, jobContext, stepsContext, jobNames});
# </template: update_comment_on_finish>


matrix_tests:
name: Matrix tests
needs:
Expand Down Expand Up @@ -3370,7 +3430,7 @@ jobs:
runs-on: ubuntu-latest
env:
JOB_NAMES: |
{"build_be":"Build BE","build_ce":"Build CE","build_ee":"Build EE","build_fe":"Build FE","build_se":"Build SE","deploy_latest_web_doc_prod_sel":"(Prod) Deploy latest doc","deploy_latest_web_site_prod_sel":"(Prod) Deploy latest site","dhctl_tests":"Dhctl Tests","doc_web_build":"Doc web build","go_generate":"Go Generate","golangci_lint":"GolangCI Lint","main_web_build":"Main web build","matrix_tests":"Matrix tests","openapi_test_cases":"OpenAPI Test Cases","tests":"Tests","validators":"Validators","web_links_test":"Web links test","workflow_render":"Render workflow"}
{"build_be":"Build BE","build_ce":"Build CE","build_ee":"Build EE","build_fe":"Build FE","build_se":"Build SE","deploy_latest_web_doc_prod_sel":"(Prod) Deploy latest doc","deploy_latest_web_site_prod_sel":"(Prod) Deploy latest site","dhctl_tests":"Dhctl Tests","doc_web_build":"Doc web build","go_generate":"Go Generate","golangci_lint":"GolangCI Lint","main_web_build":"Main web build","matrix_tests":"Matrix tests","openapi_test_cases":"OpenAPI Test Cases","tests":"Tests","tests_python_webhooks":"Tests python webhooks","validators":"Validators","web_links_test":"Web links test","workflow_render":"Render workflow"}
steps:

# <template: checkout_step>
Expand Down
20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ TESTS_TIMEOUT="15m"

deps: bin/golangci-lint bin/trivy bin/regcopy bin/jq bin/yq bin/crane bin/promtool bin/gator bin/werf bin/gh ## Install dev dependencies.

##@ Security
bin:
mkdir -p bin

##@ Tests

bin/promtool-${PROMTOOL_VERSION}/promtool:
Expand All @@ -130,7 +134,11 @@ bin/gator: bin/gator-${GATOR_VERSION}/gator
rm -f bin/gator
ln -s /deckhouse/bin/gator-${GATOR_VERSION}/gator bin/gator

.PHONY: tests-modules tests-matrix tests-openapi tests-controller
.PHONY: bin/yq
bin/yq: bin ## Install yq deps for update-patchversion script.
curl -sSfL https://github.com/mikefarah/yq/releases/download/v4.25.3/yq_$(YQ_PLATFORM)_$(YQ_ARCH) -o bin/yq && chmod +x bin/yq

.PHONY: tests-modules tests-matrix tests-openapi tests-controller tests-webhooks
tests-modules: ## Run unit tests for modules hooks and templates.
##~ Options: FOCUS=module-name
go test -timeout=${TESTS_TIMEOUT} -vet=off ${TESTS_PATH}
Expand All @@ -145,6 +153,9 @@ tests-openapi: ## Run tests against modules openapi values schemas.
tests-controller: ## Run deckhouse-controller unit tests.
go test ./deckhouse-controller/... -v

tests-webhooks: bin/yq ## Run python webhooks unit tests.
./testing/webhooks/run.sh

.PHONY: validate
validate: ## Check common patterns through all modules.
go test -tags=validation -run Validation -timeout=${TESTS_TIMEOUT} ./testing/...
Expand Down Expand Up @@ -191,10 +202,6 @@ generate: bin/werf ## Run all generate-* jobs in bulk.
render-workflow: ## Generate CI workflow instructions.
./.github/render-workflows.sh

##@ Security
bin:
mkdir -p bin

bin/regcopy: bin ## App to copy docker images to the Deckhouse registry
cd tools/regcopy; go build -o bin/regcopy

Expand Down Expand Up @@ -279,9 +286,6 @@ bin/jq: bin bin/jq-$(JQ_VERSION)/jq ## Install jq deps for update-patchversion s
rm -f bin/jq
ln -s jq-$(JQ_VERSION)/jq bin/jq

bin/yq: bin ## Install yq deps for update-patchversion script.
curl -sSfL https://github.com/mikefarah/yq/releases/download/v4.25.3/yq_$(YQ_PLATFORM)_$(YQ_ARCH) -o bin/yq && chmod +x bin/yq

bin/crane: bin ## Install crane deps for update-patchversion script.
curl -sSfL https://github.com/google/go-containerregistry/releases/download/v0.10.0/go-containerregistry_$(OS_NAME)_$(CRANE_ARCH).tar.gz | tar -xzf - crane && mv crane bin/crane && chmod +x bin/crane

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
deckhouse==0.4.9
dictdiffer==0.9.0
dotmap==1.3.30

This file was deleted.

Loading
Loading