Skip to content

Commit 9fd50f2

Browse files
committed
func_tests
1 parent c4064a9 commit 9fd50f2

9 files changed

Lines changed: 79 additions & 5 deletions

File tree

.github/workflows/build.yml

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ env:
77
ARTIFACTS_PATH: artifacts
88
PROJECT_NAME: exordos_core
99
REPO_ENDPOINT_PUT: http://10.20.0.1:8082
10+
PACKER_VERSION: "1.9.2"
11+
PYTHON_VERSION: "3.12"
12+
CORE_BRANCH: "master"
13+
CORE_ENDPOINT_URL: http://10.20.0.2:11010
14+
CORE_USERNAME: "admin"
15+
CORE_PASSWORD: "admin"
16+
ALLOW_USER_PASSWD: "true"
1017

1118
jobs:
1219
Build:
@@ -47,4 +54,52 @@ jobs:
4754
with:
4855
name: build_artifacts
4956
path: artifacts/
50-
57+
FuncTests:
58+
needs: Build
59+
if : ${{ github.actor != 'dependabot[bot]' }}
60+
runs-on: ubuntu-24.04
61+
steps:
62+
- uses: actions/checkout@v6
63+
- name: Setup `packer`
64+
uses: hashicorp/setup-packer@main
65+
with:
66+
version: ${{ env.PACKER_VERSION }}
67+
- name: Install exordos
68+
run: curl -fsSL https://repository.genesis-core.tech/install.sh | sudo sh
69+
- name: set exordos config
70+
run: |
71+
exordos settings set-realm default --endpoint $CORE_ENDPOINT_URL
72+
exordos settings set-context default --name default --user $CORE_USERNAME --password $CORE_PASSWORD
73+
- name: Install hypervisor
74+
run: sudo exordos compute hypervisors init
75+
- name: Download build artifacts
76+
uses: actions/download-artifact@v8
77+
with:
78+
name: build_artifacts
79+
path: artifacts/
80+
- name: bootstrap exordos core
81+
run: |
82+
VERSION=$(cat artifacts/version.txt)
83+
# VERSION=0.0.9
84+
exordos bootstrap -i $VERSION -f -m core --admin-password $CORE_PASSWORD --cidr 10.20.0.0/22
85+
- name: sleep
86+
run: |
87+
sleep 10
88+
- name: check exordos core
89+
run: |
90+
set -eux
91+
92+
for i in {1..10}; do
93+
exordos e e list
94+
95+
sleep 1
96+
done
97+
exordos e e show core
98+
exordos compute nodes list
99+
exordos compute hypervisors list
100+
- name: Setup tmate session
101+
# if: ${{ failure() }}
102+
uses: mxschmitt/action-tmate@v3
103+
timeout-minutes: 10
104+
with:
105+
limit-access-to-actor: true

.github/workflows/inventory.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ permissions:
99
contents: read
1010

1111
jobs:
12-
Build:
12+
build_elements_inventory:
1313
runs-on: hard
1414
strategy:
1515
fail-fast: true

.github/workflows/tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- 'mkdocs.yml'
88
- '.markdownlint.yaml'
99
pull_request:
10+
types: [opened]
1011
paths-ignore:
1112
- 'docs/**'
1213
- 'mkdocs.yml'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,5 @@ docs/source/*.png
137137

138138
# postgres
139139
pgdata/
140+
141+
.tasks

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ help:
1111
@echo "bootstrap - bootstrap exordos core"
1212

1313
build_core:
14-
exordos build -i $(SSH_KEY) -f --manifest-var repository=https://repository.genesis-core.tech
14+
exordos build -i $(SSH_KEY) -f . --manifest-var repository=https://repository.genesis-core.tech
1515

1616
bootstrap:
1717
exordos bootstrap -i output/inventory.json -f -m core --admin-password admin --cidr 10.20.0.0/22

exordos_core/cmd/bootstrap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def _install_element_manifest(
284284
return
285285

286286
os.system(
287-
f"exordos --config {GCTL_CFG_DIR}/exordosctl.yaml elements install {manifest_path}"
287+
f"exordos --config {GCTL_CFG_DIR}/exordosctl.yaml e e install {manifest_path}"
288288
)
289289

290290

exordos_core/cmd/elements_inventory.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def merge_inventories(inventory_files):
4343
"""Merge all found inventory files into one list."""
4444
result_inventory = {"elements": {}}
4545

46+
latest_version = None
4647
for file_path in inventory_files:
4748
try:
4849
with open(file_path, "r") as f:
@@ -51,6 +52,11 @@ def merge_inventories(inventory_files):
5152
result_inventory["elements"][data["name"]] = {}
5253

5354
result_inventory["elements"][data["name"]][data["version"]] = data
55+
56+
if latest_version is None or data["version"] > latest_version:
57+
latest_version = data["version"]
58+
result_inventory["elements"][data["name"]]["latest"] = data
59+
5460
except Exception as e:
5561
print(f"Error reading {file_path}: {e}")
5662

@@ -74,7 +80,7 @@ def main():
7480
root_dir = os.path.join(REPOSITORY_DIR, elements_dir)
7581
output_file = os.path.join(root_dir, "inventory.json")
7682

77-
print("Searching for inventory.json files...")
83+
print(f"Searching for inventory.json files in {root_dir}...")
7884
inventory_files = find_inventory_files(root_dir)
7985

8086
if not inventory_files:

exordos_core/common/constants.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,7 @@
8484
VAR_HS256_JWKS_ENCRYPTION_KEY_UUID = sys_uuid.UUID(
8585
"c371a647-e1a6-4bec-bef2-a50041bc5af2"
8686
)
87+
88+
REPOSITORY_URL = "https://repository.genesis-core.tech"
89+
ELEMENTS_PATH = "exordos-elements"
90+
INVENTORY_URL = f"{REPOSITORY_URL}/{ELEMENTS_PATH}/inventory.json"

exordos_core/tests/functional/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from urllib.parse import urlparse
2020
import uuid as sys_uuid
2121

22+
import bazooka
2223
from gcl_iam import tokens
2324
from gcl_iam.tests.functional import clients as iam_clients
2425
from gcl_sdk.agents.universal.dm import models as sdk_ua_models
@@ -931,3 +932,8 @@ def full_manifest_schema():
931932
@pytest.fixture(scope="session")
932933
def user_api_spec():
933934
return element_utils.load_user_api_spec()
935+
936+
937+
@pytest.fixture(scope="session")
938+
def inventory():
939+
return bazooka.get(c.INVENTORY_URL).json()

0 commit comments

Comments
 (0)