Skip to content

Commit

Permalink
fix: example e2e tests
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <xpf6677@163.com>
  • Loading branch information
Peefy committed Jul 31, 2024
1 parent d78297a commit e8a422c
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 6 deletions.
3 changes: 1 addition & 2 deletions examples/package-management/git/my_package/kcl.mod.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[dependencies]
[dependencies.konfig]
name = "konfig"
full_name = "konfig_v0.0.1"
version = "v0.0.1"
full_name = "_"
sum = "XFvHdBAoY/+qpJWmj8cjwOwZO8a3nX/7SE35cTxQOFU="
url = "https://github.com/awesome-kusion/konfig.git"
git_tag = "v0.0.1"
5 changes: 3 additions & 2 deletions examples/server/server.k
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ schema Server(Deployment):

schema Deployment[priority: int]:
name: str
cpu: int = _cpu
memory: int = _cpu * 2
volumes?: [Volume]
image: str
service?: Service
Expand All @@ -49,6 +47,9 @@ schema Deployment[priority: int]:
else:
_cpu = 2048

cpu: int = _cpu
memory: int = _cpu * 2

check:
multiplyof(cpu, 256), "CPU must be a multiple of 256"
regex.match(image, "^[a-zA-Z]+:\d+\.\d+\.\d+$"), "image name should be like 'nginx:1.14.2'"
Expand Down
5 changes: 5 additions & 0 deletions examples/settings/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
run:
kcl run -Y settings.yaml

test:
make run
2 changes: 2 additions & 0 deletions examples/settings/file.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
env = option("env-type")
deploy_topology = option("deploy-topology")
13 changes: 13 additions & 0 deletions examples/settings/settings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
kcl_cli_configs:
files:
- file.k
kcl_options:
- key: env-type
value: TEST
- key: deploy-topology
value:
- cluster: my-cluster
idc: my-idc
replicas: 2
workspace: my-workspace
zone: my-zone
2 changes: 1 addition & 1 deletion examples/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
$ErrorActionPreference = "Stop"
$pwd = Split-Path -Parent $MyInvocation.MyCommand.Path

$paths = @("configuration", "validation", "abstraction", "definition", "konfig", "mutation", "data-integration", "automation", "package-management", "kubernetes", "codelab", "server", "source")
$paths = @("configuration", "validation", "abstraction", "definition", "konfig", "mutation", "data-integration", "automation", "package-management", "kubernetes", "codelab", "server", "settings", "source")
foreach ($path in $paths) {
Write-Host "Testing $path ..."
Set-Location -Path "$pwd\$path"
Expand Down
2 changes: 1 addition & 1 deletion examples/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pwd=$(
pwd
)

for path in "configuration" "validation" "abstraction" "definition" "konfig" "mutation" "data-integration" "automation" "package-management" "kubernetes" "codelab" "server" "source"; do
for path in "configuration" "validation" "abstraction" "definition" "konfig" "mutation" "data-integration" "automation" "package-management" "kubernetes" "codelab" "server" "settings" "source"; do
echo "\033[1mTesting $path ...\033[0m"
if (cd $pwd/$path && make test); then
echo "\033[32mTest SUCCESSED - $path\033[0m\n"
Expand Down

0 comments on commit e8a422c

Please sign in to comment.