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

Handling tests #14

Merged
merged 36 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
52c9b29
docs: updated README
karl-cardenas-coding Jun 24, 2024
65193f4
test: added test suit
karl-cardenas-coding Jun 25, 2024
e7948f3
chore: fixed error condition
karl-cardenas-coding Jun 25, 2024
fe560a6
ci: added require files check
karl-cardenas-coding Jun 25, 2024
d48f4be
Merge branch 'main' into handling-tests
karl-cardenas-coding Jun 25, 2024
13a9184
test: added more tests
karl-cardenas-coding Jun 25, 2024
179bd80
Merge branch 'handling-tests' of github.com:spectrocloud/spectro-vale…
karl-cardenas-coding Jun 25, 2024
f353688
test: added more tests
karl-cardenas-coding Jun 25, 2024
e86db89
test: added more tests
karl-cardenas-coding Jun 25, 2024
8898e11
test: more test and minor refactoring
karl-cardenas-coding Jun 25, 2024
0306506
test: added more tests
karl-cardenas-coding Jun 25, 2024
9d5a5b1
test: added new tests
karl-cardenas-coding Jun 25, 2024
29b1cdd
test: added more tests
karl-cardenas-coding Jun 25, 2024
3d04a80
test: more tests
karl-cardenas-coding Jun 25, 2024
69c1ad6
ci: added vale version
karl-cardenas-coding Jun 26, 2024
11cbdf3
ci: verify vale
karl-cardenas-coding Jun 26, 2024
c1b07e1
test: fixed file format
karl-cardenas-coding Jun 26, 2024
6d128b6
test: all test added
karl-cardenas-coding Jun 26, 2024
5d86f71
ci: fix bash error
karl-cardenas-coding Jun 26, 2024
711381e
ci: another approach
karl-cardenas-coding Jun 26, 2024
be6eae5
ci: more tests
karl-cardenas-coding Jun 26, 2024
3982024
ci: add debug
karl-cardenas-coding Jun 26, 2024
c078e3e
ci: more debug
karl-cardenas-coding Jun 26, 2024
8d41069
ci: more debug
karl-cardenas-coding Jun 26, 2024
cb5038f
ci: test
karl-cardenas-coding Jun 26, 2024
9217683
ci: investiage false positive
karl-cardenas-coding Jun 26, 2024
52fa214
ci: more debug
karl-cardenas-coding Jun 26, 2024
f8bb59f
ci: more debug
karl-cardenas-coding Jun 26, 2024
7a4a618
ci: more debug
karl-cardenas-coding Jun 26, 2024
3c48abc
ci: debug
karl-cardenas-coding Jun 26, 2024
922bc23
ci: test
karl-cardenas-coding Jun 26, 2024
84f2afc
test: debug
karl-cardenas-coding Jun 26, 2024
8f3d8a7
ci: more debug
karl-cardenas-coding Jun 26, 2024
e1f4af9
ci: progress
karl-cardenas-coding Jun 26, 2024
5e3c583
chore: tests
karl-cardenas-coding Jun 26, 2024
e8567aa
test: all test ready
karl-cardenas-coding Jun 26, 2024
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
53 changes: 53 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Pull Requests

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

concurrency:
group: pr-${{ github.ref }}
cancel-in-progress: true

env:
VALE_VERSION: "3.6.0"

jobs:
run-ci:
# runs-on: ubuntu-latest
runs-on: ubuntu-latest
defaults:
run:
shell: bash
if: ${{ !github.event.pull_request.draft && github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' }}
steps:
# If the condition above is not met, aka, the PR is not in draft status, then this step is skipped.
# Because this step is part of the critical path, omission of this step will result in remaining CI steps not gettinge executed.
# As of 8/8/2022 there is now way to enforce this beahvior in GitHub Actions CI.
- run: exit 0

requirements:
runs-on: ubuntu-latest
needs: run-ci
defaults:
run:
shell: bash
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Get Vale
run: |
URL="https://github.com/errata-ai/vale/releases/download/v${VALE_VERSION}/vale_${VALE_VERSION}_Linux_64-bit.tar.gz"
wget --quiet $URL --output-document vale.tar.gz
tar -xzf vale.tar.gz
chmod +x vale
sudo mv vale /usr/local/bin/

- name: Vale Version
run: vale --version

- name: Test Files Present?
run: make required_files

- name: Tests
run: make tests
2 changes: 1 addition & 1 deletion .github/workflows/vale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
inputs:
version:
description: "The version of the Vale to use"
default: "3.5.0"
default: "3.6.0"
type: string
required: false

Expand Down
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ubuntu:24.04

COPY . /app

ENV VALE_VERSION="2.3.0"

RUN apt-get update && apt-get install wget make -y

RUN URL="https://github.com/errata-ai/vale/releases/download/v${VALE_VERSION}/vale_${VALE_VERSION}_Linux_64-bit.tar.gz" && \
wget --quiet $URL --output-document vale.tar.gz && \
tar -xzf vale.tar.gz && \
chmod +x vale && \
mv vale /usr/local/bin/

WORKDIR /app


CMD ["make", "tests"]
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.PHONY: license


##@ Development

help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[0m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

Expand All @@ -9,7 +11,18 @@ init: ## Initialize the project
npm ci


##@ Development
##@ Testing

required_files: ## Check if required files are present
@echo "Checking if required files are present..."
./scripts/missing_tests.sh packages


tests: ## Run tests
@echo "Running tests..."
./scripts/check_rule.sh packages

##@ Publish

zip: ## Create the spectrocloud package
./scripts/create_zip.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

extends: conditional
message: "Use title case to define the acronym '%s'."
link: 'https://spectrocloud.atlassian.net/wiki/spaces/DE/pages/1765933057/Spectro+Cloud+Internal+Style+Guide#Acronyms'
link: "https://spectrocloud.atlassian.net/wiki/spaces/DE/pages/1765933057/Spectro+Cloud+Internal+Style+Guide#Acronyms"
level: error
ignorecase: false
scope: text
# Match two to five capital letters surrounded by brackets
# Match two to five capital letters surrounded by brackets
# to detect an acronym definition.
first: '[(][A-Z]{2,5}[)]'
# Match two to five capitalised words separated by any number of dashes
first: "[(][A-Z]{2,5}[)]"
# Match two to five capitalised words separated by any number of dashes
# or whitespaces before the acronym definition.
second: '(\b(([A-Z][a-z]+)[\-\s ]{1,}){2,5})([(][A-Z]{2,5}[)])'
exceptions:
Expand All @@ -35,7 +35,6 @@ exceptions:
- (JPEG)
- (JPG)
- (JSON)
- (OS)
- (OSS)
- (PDF)
- (PNG)
Expand All @@ -56,4 +55,4 @@ exceptions:
- (XML)
- (ZIP)
- (PXK)
- (PXK-E)
- (PXK-E)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ message: "The ':::note' admonition is not approved under the Spectro Cloud style
link: https://spectrocloud.atlassian.net/wiki/spaces/DE/pages/1765933057/Spectro+Cloud+Internal+Style+Guide#Admonitions/Callouts
level: error
nonword: true
scope: raw
ignorecase: true
swap:
":::note": ":::info"
":::note": ":::info"
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ message: "Avoid documenting features that are not available at present. You ment
level: error
ignorecase: true
tokens:
- 'coming soon'
- 'in the future'
- 'not yet available'
- 'will be released'
- 'to be implemented'
- 'under development'
- "coming soon"
- "in the future"
- "not yet available"
- "will be released"
- "to be implemented"
- "under development"
- "next release"
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
# SPDX-License-Identifier: Apache-2.0

extends: existence
message: "Avoid using a noun that starts with an '-ing' in headings. Your heading starts with '%s'."
message: "Avoid using a noun that starts with an -ing in headings. Your heading starts with a word ending in '%s'."
level: error
scope: heading
raw:
- '\n\n\# [a-z]*ing '
- '\n\n\#\# [a-z]*ing '
- '\n\n\#\#\# [a-z]*ing '
- '\n\n\#\#\#\# [a-z]*ing '
- '\n\n\#\#\#\#\# [a-z]*ing '
- '\n\n\#\#\#\#\#\# [a-z]*ing '
- "ing\\b"
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ message: "Consider avoiding '%s' in favor of more inclusive language."
link: "https://spectrocloud.atlassian.net/wiki/x/AQBCaQ"
ignorecase: true
level: error
tokens:
- master
- slave
nonword: true
exceptions:
- master branch
scope: raw
tokens:
- '\b(master)\b(?! branch)'
- '\bslave\b'
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ link: https://spectrocloud.atlassian.net/wiki/spaces/DE/pages/1765933057/Spectro
scope: sentence
nonword: true
tokens:
- '(\b(?:\w+(?: \w+)?, )+\b(?:\w+(?: \w+)?) (?:and|or) \w+(?: \w+)?[.?!])'
- '\b\w+(?: \w+)*, \w+(?: \w+)* (and|or) \w+(?: \w+)*[.?!]'

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) Spectro Cloud
# SPDX-License-Identifier: Apache-2.0

extends: existence
message: "Try to avoid using first-person plural. Avoid terms such as '%s'. Address the user directly."
link: "https://spectrocloud.atlassian.net/wiki/spaces/DE/pages/1765933057/Spectro+Cloud+Internal+Style+Guide#Active-voice"
level: warning
ignorecase: true
tokens:
- ours?
- us
- let's
- we can
exceptions:
- we recommend
4 changes: 4 additions & 0 deletions packages/spectrocloud-docs-internal/tests/ableism/.vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
StylesPath = ../../styles/
MinAlertLevel = suggestion
[*.md]
spectrocloud-docs-internal.ableism = YES
9 changes: 9 additions & 0 deletions packages/spectrocloud-docs-internal/tests/ableism/fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Instructions

You can access the cluster by running the following command.

```bash
kubectl get pods
```

You can see all the pods that are running in the cluster.
9 changes: 9 additions & 0 deletions packages/spectrocloud-docs-internal/tests/ableism/pass.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Instructions

You can access the cluster by issuing the following command.

```bash
kubectl get pods
```

The output displays all the pods active in the cluster.
4 changes: 4 additions & 0 deletions packages/spectrocloud-docs-internal/tests/acronym/.vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
StylesPath = ../../styles/
MinAlertLevel = suggestion
[*.md]
spectrocloud-docs-internal.acronym = YES
13 changes: 13 additions & 0 deletions packages/spectrocloud-docs-internal/tests/acronym/fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Troubleshooting

Use the following steps to resolve the operating system (OS) error.

1. Log in to the system console of the OS.

2. Download the API log from the Logs tab.

:::info

You can downlog the log in HTML or JSON format.

:::
13 changes: 13 additions & 0 deletions packages/spectrocloud-docs-internal/tests/acronym/pass.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Troubleshooting

Use the following steps to resolve the Operating System (OS) error.

1. Log in to the system console of the OS.

2. Download the API log from the Logs tab.

:::note

You can downlog the log in HTML or JSON format.

:::
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
StylesPath = ../../styles/
MinAlertLevel = suggestion
[*.md]
spectrocloud-docs-internal.admonitions = YES
17 changes: 17 additions & 0 deletions packages/spectrocloud-docs-internal/tests/admonitions/fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Learn to Use Palette

In this tutorial, you will learn how to use Palette to deploy a Kubernetes cluster.

:::note

This tutorial does not cover Edge clusters.

:::

The following table lists the supported operating systems for the Palette platform.

:::note

This will trigger a failure.

:::
17 changes: 17 additions & 0 deletions packages/spectrocloud-docs-internal/tests/admonitions/pass.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Learn to Use Palette

In this tutorial, you will learn how to use Palette to deploy a Kubernetes cluster.

:::info

This tutorial does not cover Edge clusters.

:::

The following table lists the supported operating systems for the Palette platform.

:::info

This will not trigger a failure.

:::
4 changes: 4 additions & 0 deletions packages/spectrocloud-docs-internal/tests/brand/.vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
StylesPath = ../../styles/
MinAlertLevel = suggestion
[*.md]
spectrocloud-docs-internal.brand = YES
3 changes: 3 additions & 0 deletions packages/spectrocloud-docs-internal/tests/brand/fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Company Information

The organization, spectro cloud, was founded in 2019. We can be reached at [email protected]
9 changes: 9 additions & 0 deletions packages/spectrocloud-docs-internal/tests/brand/pass.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Company Information

The organization, Spectro Cloud, was founded in 2019. We can be reached at [email protected]. You can also visit our website at [https://spectrocloud.com](https://spectrocloud.com).

We also have a hidden CLI.

```shell
spectrocloud --version
```
4 changes: 4 additions & 0 deletions packages/spectrocloud-docs-internal/tests/colon/.vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
StylesPath = ../../styles/
MinAlertLevel = suggestion
[*.md]
spectrocloud-docs-internal.colon = YES
21 changes: 21 additions & 0 deletions packages/spectrocloud-docs-internal/tests/colon/fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### Deploying Cluster Profile

Use the following command to remove all previous configurations:

```bash
kubectl delete -f cluster-profile.yaml
```

:::info

This callout is allowed.

:::

A few things to keep in mind before removing the cluster profile:

- The cluster profile is removed Palette

- Active clusters are not affected.

- Names starting with `project:scope` are reserved for internal use.
Loading