-
Notifications
You must be signed in to change notification settings - Fork 9
feat(integration): Add missing tests for misc commands and features #419
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // SPDX-License-Identifier: BSD-3-Clause | ||
| // Copyright (c) 2026, Unikraft GmbH and The Unikraft CLI Authors. | ||
| // Licensed under the BSD-3-Clause License (the "License"). | ||
| // You may not use this file except in compliance with the License. | ||
|
|
||
| package integration | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| ) | ||
|
|
||
| func TestMetros(t *testing.T) { | ||
| t.Run("get", func(t *testing.T) { | ||
| r := runner(t, true, []string{staging, stable}) | ||
|
|
||
| out := r.Run(t, []string{"unikraft", "metro", "get", r.Config.MetroName}) | ||
| assert.Contains(t, out, "name:") | ||
| assert.Contains(t, out, r.Config.MetroName) | ||
| assert.Contains(t, out, "endpoint:") | ||
| }) | ||
|
|
||
| t.Run("get-quotas", func(t *testing.T) { | ||
| r := runner(t, true, []string{staging, stable}) | ||
|
|
||
| out := r.Run(t, []string{"unikraft", "metro", "get", r.Config.MetroName, "-f", "+quotas"}) | ||
| assert.Contains(t, out, "quotas:") | ||
| assert.Contains(t, out, "instances:") | ||
| assert.Contains(t, out, "vcpus:") | ||
| }) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| // SPDX-License-Identifier: BSD-3-Clause | ||
| // Copyright (c) 2026, Unikraft GmbH and The Unikraft CLI Authors. | ||
| // Licensed under the BSD-3-Clause License (the "License"). | ||
| // You may not use this file except in compliance with the License. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm. Just noticed this is inconsistent, weird. Let's add this to the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, in a separate PR |
||
|
|
||
| package integration | ||
|
|
||
|
|
@@ -9,6 +10,8 @@ import ( | |
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
|
|
||
| integ "unikraft.com/cli/internal/integration" | ||
| ) | ||
|
|
||
| func TestResources(t *testing.T) { | ||
|
|
@@ -37,4 +40,46 @@ func TestResources(t *testing.T) { | |
| out = r.Run(t, []string{"unikraft", "volume", "list", "--output", "quiet"}) | ||
| assert.Empty(t, strings.TrimSpace(out)) | ||
| }) | ||
|
|
||
| t.Run("multi-type-flow", func(t *testing.T) { | ||
| r := runner(t, true, []string{staging, stable}) | ||
| svcName := uniq() | ||
| instName := uniq() | ||
| domainName := uniq() | ||
| svcKey := "service:" + r.Config.MetroName + "/test-" + svcName | ||
| instKey := "instance:" + r.Config.MetroName + "/test-" + instName | ||
|
|
||
| r.Run(t, []string{ | ||
| "unikraft", "resource", "create", | ||
| "--set", "type=service", | ||
| "--set", "name=test-" + svcName, | ||
| "--set", "metro=" + r.Config.MetroName, | ||
| "--set", "services=443:8080/tls+http", | ||
| }) | ||
| r.Run(t, []string{ | ||
| "unikraft", "resource", "create", | ||
| "--set", "type=instance", | ||
| "--set", "name=test-" + instName, | ||
| "--set", "metro=" + r.Config.MetroName, | ||
| "--set", "image=nginx:latest", | ||
| "--set", "autostart=false", | ||
| "--set", "resources.memory=128", | ||
| "--set", "resources.vcpus=1", | ||
| }) | ||
|
|
||
| out := r.Run(t, []string{"unikraft", "resource", "get", svcKey, instKey}) | ||
| assert.Contains(t, out, "test-"+svcName) | ||
| assert.Contains(t, out, "test-"+instName) | ||
|
|
||
| r.Run(t, []string{ | ||
| "unikraft", "resource", "edit", svcKey, | ||
| "--add", "domains=fqdn=" + domainName + ".unikraft.example", | ||
| }) | ||
| out = r.Run(t, []string{"unikraft", "resource", "get", svcKey}) | ||
| assert.Contains(t, out, domainName+".unikraft.example") | ||
|
|
||
| r.Run(t, []string{"unikraft", "resource", "delete", svcKey, instKey}) | ||
| r.Run(t, []string{"unikraft", "service", "inspect", "test-" + svcName}, integ.ExpectFail()) | ||
| r.Run(t, []string{"unikraft", "instance", "inspect", "test-" + instName}, integ.ExpectFail()) | ||
| }) | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.