Skip to content

Commit

Permalink
test: add integration tests
Browse files Browse the repository at this point in the history
WIP

Signed-off-by: Artem Chernyshev <[email protected]>
  • Loading branch information
Unix4ever committed Oct 21, 2024
1 parent 8c4fc0b commit 0d501b7
Show file tree
Hide file tree
Showing 20 changed files with 1,020 additions and 49 deletions.
48 changes: 48 additions & 0 deletions .conform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-09-30T14:59:39Z by kres 8be5fa7.

policies:
- type: commit
spec:
dco: true
gpg:
required: true
identity:
gitHubOrganization: siderolabs
spellcheck:
locale: US
maximumOfOneCommit: true
header:
length: 89
imperative: true
case: lower
invalidLastCharacters: .
body:
required: true
conventional:
types:
- chore
- docs
- perf
- refactor
- style
- test
- release
scopes:
- .*
- type: license
spec:
root: .
skipPaths:
- .git/
- testdata/
includeSuffixes:
- .go
excludeSuffixes:
- .pb.go
- .pb.gw.go
header: |
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
31 changes: 30 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-10-02T19:28:55Z by kres 34e72ac.
# Generated on 2024-10-18T16:18:03Z by kres 34e72ac.

name: default
concurrency:
Expand Down Expand Up @@ -67,6 +67,12 @@ jobs:
driver: remote
endpoint: tcp://buildkit-amd64.ci.svc.cluster.local:1234
timeout-minutes: 10
- name: Mask secrets
run: |
echo "$(sops -d .secrets.yaml | yq -e '.secrets | to_entries[] | "::add-mask::" + .value')"
- name: Set secrets for job
run: |
sops -d .secrets.yaml | yq -e '.secrets | to_entries[] | .key + "=" + .value' >> "$GITHUB_ENV"
- name: base
run: |
make base
Expand Down Expand Up @@ -104,6 +110,29 @@ jobs:
PUSH: "true"
run: |
make image-omni-infra-provider-kubevirt IMAGE_TAG=latest
- name: run-integration-test
run: |
sudo -E make run-integration-test
- name: Generate executable list
run: |
find _out -type f -executable > _out/executable-artifacts
- name: save-artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts
path: |-
_out
!_out/omni/
retention-days: "5"
- name: save-talos-logs-artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: talos-logs
path: |-
~/.talos/clusters/**/*.log
!~/.talos/clusters/**/swtpm.log
retention-days: "5"
- name: Generate Checksums
if: startsWith(github.ref, 'refs/tags/')
run: |
Expand Down
135 changes: 135 additions & 0 deletions .kres.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
---
kind: common.Build
spec:
ignoredPaths:
- "hack/compose/docker-compose.override.yml"
---
kind: service.CodeCov
spec:
# the tool should be tested by Omni integration tests
enabled: false
---
kind: golang.Generate
spec:
baseSpecPath: /api
vtProtobufEnabled: true
specs:
- source: api/specs/specs.proto
subdirectory: specs
---
kind: auto.CustomSteps
spec:
steps:
- name: docker-compose-up
toplevel: true
- name: docker-compose-down
toplevel: true
- name: run-integration-test
toplevel: true
---
kind: custom.Step
name: docker-compose-up
spec:
makefile:
enabled: true
phony: true
script:
- >-
ARTIFACTS="$(ARTIFACTS)"
SHA="$(SHA)"
TAG="$(TAG)"
USERNAME="$(USERNAME)"
REGISTRY="$(REGISTRY)"
PROTOBUF_TS_VERSION="$(PROTOBUF_TS_VERSION)"
NODE_BUILD_ARGS="$(NODE_BUILD_ARGS)"
TOOLCHAIN="$(TOOLCHAIN)"
CGO_ENABLED="$(CGO_ENABLED)"
GO_BUILDFLAGS="$(GO_BUILDFLAGS)"
GOLANGCILINT_VERSION="$(GOLANGCILINT_VERSION)"
GOFUMPT_VERSION="$(GOFUMPT_VERSION)"
GOIMPORTS_VERSION="$(GOIMPORTS_VERSION)"
PROTOBUF_GO_VERSION="$(PROTOBUF_GO_VERSION)"
GRPC_GO_VERSION="$(GRPC_GO_VERSION)"
GRPC_GATEWAY_VERSION="$(GRPC_GATEWAY_VERSION)"
VTPROTOBUF_VERSION="$(VTPROTOBUF_VERSION)"
DEEPCOPY_VERSION="$(DEEPCOPY_VERSION)"
TESTPKGS="$(TESTPKGS)"
COMPOSE_DOCKER_CLI_BUILD=1
DOCKER_BUILDKIT=1
GO_LDFLAGS="$(GO_LDFLAGS)"
docker compose -p talemu --file ./hack/compose/docker-compose.yml --file ./hack/compose/docker-compose.override.yml up --build
---
kind: custom.Step
name: docker-compose-down
spec:
makefile:
enabled: true
phony: true
variables:
- name: REMOVE_VOLUMES
defaultValue: false
script:
- >-
ARTIFACTS="$(ARTIFACTS)"
SHA="$(SHA)"
TAG="$(TAG)"
USERNAME="$(USERNAME)"
REGISTRY="$(REGISTRY)"
PROTOBUF_TS_VERSION="$(PROTOBUF_TS_VERSION)"
NODE_BUILD_ARGS="$(NODE_BUILD_ARGS)"
TOOLCHAIN="$(TOOLCHAIN)"
CGO_ENABLED="$(CGO_ENABLED)"
GO_BUILDFLAGS="$(GO_BUILDFLAGS)"
GOLANGCILINT_VERSION="$(GOLANGCILINT_VERSION)"
GOFUMPT_VERSION="$(GOFUMPT_VERSION)"
GOIMPORTS_VERSION="$(GOIMPORTS_VERSION)"
PROTOBUF_GO_VERSION="$(PROTOBUF_GO_VERSION)"
GRPC_GO_VERSION="$(GRPC_GO_VERSION)"
GRPC_GATEWAY_VERSION="$(GRPC_GATEWAY_VERSION)"
VTPROTOBUF_VERSION="$(VTPROTOBUF_VERSION)"
DEEPCOPY_VERSION="$(DEEPCOPY_VERSION)"
TESTPKGS="$(TESTPKGS)"
COMPOSE_DOCKER_CLI_BUILD=1
DOCKER_BUILDKIT=1
GO_LDFLAGS="$(GO_LDFLAGS)"
docker compose -p talemu --file ./hack/compose/docker-compose.yml --file ./hack/compose/docker-compose.override.yml down --rmi local --remove-orphans --volumes=$(REMOVE_VOLUMES)
---
kind: custom.Step
name: run-integration-test
spec:
sudoInCI: true
makefile:
enabled: true
depends:
- omni-infra-provider-kubevirt
script:
- >-
@hack/test/integration.sh
ghaction:
enabled: true
sops: true
artifacts:
enabled: true
extraPaths:
- "!_out/omni/"
additional:
- name: talos-logs
always: true
continueOnError: true
paths:
- "~/.talos/clusters/**/*.log"
- "!~/.talos/clusters/**/swtpm.log"
---
kind: common.SOPS
spec:
enabled: true
config: |-
creation_rules:
- age: age1xrpa9ujxxcj2u2gzfrzv8mxak4rts94a6y60ypurv6rs5cpr4e4sg95f0k
# order: Andrey, Noel, Artem, Utku, Dmitriy
pgp: >-
15D5721F5F5BAF121495363EFE042E3D4085A811,
CC51116A94490FA6FB3C18EB2401FCAE863A06CA,
4919F560F0D35F80CF382D76E084A2DF1143C14D,
966BC282A680D8BB3E8363E865933E76F0549B0D,
AA5213AF261C1977AF38B03A94B473337258BFD5
3 changes: 3 additions & 0 deletions .license-header.go.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
84 changes: 84 additions & 0 deletions .secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
secrets:
AUTH0_TEST_USERNAME: ENC[AES256_GCM,data:lPddHbDVfWxaEW7ujLDnWdhIBMFj2hcp,iv:oG3Ebn8ym7g/Z7L3A3BTHRHIk+zzblZKvzMKYMPSfWI=,tag:wV7xJWbnLrj/UWj0fGGQCw==,type:str]
AUTH0_TEST_PASSWORD: ENC[AES256_GCM,data:3tgQjqv5ktdnnGUQw5Lpuw==,iv:F8zYxqk5P0tV1Pvt6QBlho8H0wuX+K91pgwLzF+4kC8=,tag:HJ4s14d/u2KyP780wFDk/w==,type:str]
AUTH0_CLIENT_ID: ENC[AES256_GCM,data:HevA8uFKCOPF8W/FRjSo/pyUFN66eXwvAxaqT5LdnT0=,iv:qpWNjsRSZ28lWQJGfMoGQvLY8KRKWv1dhR07vCgIvIU=,tag:x5BS26iacdBMv2ZkdCdr3A==,type:str]
AUTH0_DOMAIN: ENC[AES256_GCM,data:2vv9ay+hC1kN46MG8E0v1Z3G7Dm0hMmLx1/AWg==,iv:9thZflFQ1yhf0jH3u6Om7RV7Y/qYzrTf82hoYrDvyG0=,tag:BUNuHJobt/NoR5FFQBIbIQ==,type:str]
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age1xrpa9ujxxcj2u2gzfrzv8mxak4rts94a6y60ypurv6rs5cpr4e4sg95f0k
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBrUExvc1oyUzdVNmgrbHh3
cDllQ2VGSzZLQWV5MkN0VU1qTjVqblFvekJZCkdyREg2RUhVSXQwM1lpcjBkb0dG
b0krdTI1MVQxcE4zSElsd0liS0xrYncKLS0tIG1nSmhVa2Z1YkhjdHpnQmg5b1lL
NXI3VkxLU0htQUZ0Ry8rYUpLTnNXYlkKzfLUus7SkKBEj+oG3f7NBe+6UVidpxRd
OvOSqsACIUJJnRdfs8/X5Jbvruz38Zt3dYR436NFo2IHtYUdHIHO3Q==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-05-06T09:52:57Z"
mac: ENC[AES256_GCM,data:4qmhG/liKJdnEBxvvnxnpb9xJpS8GGjCAHGUVM4dGtYY5+TkfgnSQyvVdg88Ag16nMDTBEeRJO6VfOYD/Wx/PfIYnajhxRm3ZYuPPSJ5t0LGqRryUtR9vJTtHuTew5gjX8FCTvjiGJzqcfTiq11HhN3Xyu7VNwwan50QUvz5oKY=,iv:Rc0/1kH74ahBkNygwFrOZymWMnPj3VCQZ7wBi1d7Rzc=,tag:Cgdjhlc24S2gklSKYe5mPw==,type:str]
pgp:
- created_at: "2024-04-18T18:21:00Z"
enc: |-
-----BEGIN PGP MESSAGE-----
hF4D/dYBJRlWfQISAQdAVAV7d4BdulmFD+opnoDgxoIcDlIGn2n7c2aWbeF1qjYw
eHfSb/A/1Anwi+uA7fXAqAayhlfTFTr9xdKr9zp+rDQt09/QN9EKG2F9gBq0LPCl
0lwBAxelOP0EUjXZtpsVk8FVZcBeuYt+U+DrAVr8yT3TUiyFvavzpxxCqUYFBjvy
z5DUSCs+YUDLpQ/Gde0qBW8LU6HO2LAGkIvfO/HAd35jVHT5EvXivMlaRb+qBg==
=hdU9
-----END PGP MESSAGE-----
fp: 15D5721F5F5BAF121495363EFE042E3D4085A811
- created_at: "2024-04-18T18:21:00Z"
enc: |-
-----BEGIN PGP MESSAGE-----
hF4D+EORkHurkvgSAQdAOxZd1WYD0pC25Y7bBmPhlz9+udxy+RiwaxL2RXs2/xYw
cIvqsTY4wokWKD3s1nFmqHDXU3GQ7+V+pCS1PXTs7YH3uwXLBaT86AUgp+JoLJmN
0lwBuFrV4rSBQ5NvY1lGmOz6zaZlf3oBvVX510bvLPG6RfUqxE5WkMl+XgYtoKNa
eK2uknJ5UhMKYJpYwi0Jcj6Ip3s0Bzt2ZR4SMYvw7QzXPvJ1W3GKboOjJAxqoQ==
=YydP
-----END PGP MESSAGE-----
fp: CC51116A94490FA6FB3C18EB2401FCAE863A06CA
- created_at: "2024-04-18T18:21:00Z"
enc: |-
-----BEGIN PGP MESSAGE-----
hF4DCsA/BhMt3V4SAQdAtLfcBQyS/chcBtMAz6cJ/q/jZihioun7AZssYBzGdFIw
jwXCKTbTFAG7ebentk4dDLYWxRRwY/lHsWyAS1kDSSfQVZNfK+ZoTrGIG1J6MYDD
0lwBazJw7Xh+MBXt9nz/Pdor4Jlnerl1PvO3BsDvql5ESbWZS/OOSFGTvuq9ZUG0
RRlvN38NSNz+R1D79U+iwsJDJ7s8qUPCNckAoU3RWkqa7Sv1rpnwLPBqZ4t6bA==
=JQty
-----END PGP MESSAGE-----
fp: 4919F560F0D35F80CF382D76E084A2DF1143C14D
- created_at: "2024-04-18T18:21:00Z"
enc: |-
-----BEGIN PGP MESSAGE-----
hQEMAxQwM84t19oOAQf/TQnaKyseOPFTpIMXoZAHsJ71jVGTdevAhOK9Vrq4ULwk
Mb/QIyjLssrxBKU2AeXPXHM3SfiboqRsfoUKLuTmBI+BZyq6xXSA5HPElS+VcodE
sLTce4en+YeWvcJ5vioNCqj0P6GTEdZfB5bXRzhJArQMyyEGvAaQG/5SKI8lJ4gW
q0jXhwWy3qZRGj+X35y+vjlorwIEjPDrrh3lddnt+I1uVO2SKO4irbO3OiLAHRUM
bTyeIdqsVJN9tWdlotPIA5+IQK+Bd+G6Tu4rGnKxsEo2wTfomcR99HTBLYIVkVSm
iswaGDffJ3DAIWEBUDdOZD1zOOAb0xESkkEfIbfcxdJcAesPBVc/jkL9cd17oHCU
sSEDeQnkFcwwfa3Lvo91CqrXx/I9Np/D6Ir/BsdYl4IUrcOtpYjVRQh3V9MfXpuY
RST6NbjIziAMOPbJaxXKOZbT+inksnFvblo39HE=
=5g11
-----END PGP MESSAGE-----
fp: 966BC282A680D8BB3E8363E865933E76F0549B0D
- created_at: "2024-04-18T18:21:00Z"
enc: |-
-----BEGIN PGP MESSAGE-----
hF4DzfZC0UNQ1VgSAQdABhWHHlBVw7gq430dMuRHIzJ4u6f5oVh8jXBbMGG8tXow
lBUy2Qo9sGgN/2Nu9/W+efxs31oceerrw4DMSalC/KWvq3teVWc8TYeHYNAd/4ci
0lwB/UsGhZio7njWdmt7chOHJgM76JUEb4eaEZCVhQCCBDTIaFffMF2b0gpgyG9p
orZob5tXAl1RsYS9ZDAlGWpuicfZ8CUxQvdSKzwBzBrBJhs+CvNVk/NFWXNS3Q==
=N/JL
-----END PGP MESSAGE-----
fp: AA5213AF261C1977AF38B03A94B473337258BFD5
unencrypted_suffix: _unencrypted
version: 3.8.1
13 changes: 13 additions & 0 deletions .sops.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-04-18T18:20:58Z by kres 92eef68-dirty.

creation_rules:
- age: age1xrpa9ujxxcj2u2gzfrzv8mxak4rts94a6y60ypurv6rs5cpr4e4sg95f0k
# order: Andrey, Noel, Artem, Utku, Dmitriy
pgp: >-
15D5721F5F5BAF121495363EFE042E3D4085A811,
CC51116A94490FA6FB3C18EB2401FCAE863A06CA,
4919F560F0D35F80CF382D76E084A2DF1143C14D,
966BC282A680D8BB3E8363E865933E76F0549B0D,
AA5213AF261C1977AF38B03A94B473337258BFD5
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-10-02T19:28:55Z by kres 34e72ac.
# Generated on 2024-10-03T14:26:39Z by kres 34e72ac.

# common variables

Expand Down Expand Up @@ -135,7 +135,7 @@ else
GO_LDFLAGS += -s
endif

all: unit-tests omni-infra-provider-kubevirt image-omni-infra-provider-kubevirt docker-compose-up docker-compose-down lint
all: unit-tests omni-infra-provider-kubevirt image-omni-infra-provider-kubevirt docker-compose-up docker-compose-down run-integration-test lint

$(ARTIFACTS): ## Creates artifacts directory.
@mkdir -p $(ARTIFACTS)
Expand Down Expand Up @@ -211,6 +211,9 @@ docker-compose-up:
docker-compose-down:
ARTIFACTS="$(ARTIFACTS)" SHA="$(SHA)" TAG="$(TAG)" USERNAME="$(USERNAME)" REGISTRY="$(REGISTRY)" PROTOBUF_TS_VERSION="$(PROTOBUF_TS_VERSION)" NODE_BUILD_ARGS="$(NODE_BUILD_ARGS)" TOOLCHAIN="$(TOOLCHAIN)" CGO_ENABLED="$(CGO_ENABLED)" GO_BUILDFLAGS="$(GO_BUILDFLAGS)" GOLANGCILINT_VERSION="$(GOLANGCILINT_VERSION)" GOFUMPT_VERSION="$(GOFUMPT_VERSION)" GOIMPORTS_VERSION="$(GOIMPORTS_VERSION)" PROTOBUF_GO_VERSION="$(PROTOBUF_GO_VERSION)" GRPC_GO_VERSION="$(GRPC_GO_VERSION)" GRPC_GATEWAY_VERSION="$(GRPC_GATEWAY_VERSION)" VTPROTOBUF_VERSION="$(VTPROTOBUF_VERSION)" DEEPCOPY_VERSION="$(DEEPCOPY_VERSION)" TESTPKGS="$(TESTPKGS)" COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 GO_LDFLAGS="$(GO_LDFLAGS)" docker compose -p talemu --file ./hack/compose/docker-compose.yml --file ./hack/compose/docker-compose.override.yml down --rmi local --remove-orphans --volumes=$(REMOVE_VOLUMES)

run-integration-test: omni-infra-provider-kubevirt
@hack/test/integration.sh

.PHONY: rekres
rekres:
@docker pull $(KRES_IMAGE)
Expand Down
3 changes: 2 additions & 1 deletion cmd/omni-infra-provider-kubevirt/data/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"required": [
"cores",
"memory",
"architecture"
"architecture",
"disk_size"
]
}
Loading

0 comments on commit 0d501b7

Please sign in to comment.