Skip to content

Commit d8a36d5

Browse files
committed
e2e/runtime-rs-tmp: init
Temporary test for runtime-rs that checks the debug shell is started.
1 parent 2f1372a commit d8a36d5

File tree

6 files changed

+106
-0
lines changed

6 files changed

+106
-0
lines changed

.github/workflows/e2e.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
${{
5656
(inputs.test-name == 'badaml-sandbox' && 'badaml-sandbox') ||
5757
(inputs.test-name == 'badaml-vuln' && 'badaml-vuln') ||
58+
(inputs.test-name == 'runtime-rs-tmp' && 'runtime-rs') ||
5859
'base'
5960
}}
6061
steps:

.github/workflows/e2e_manual.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ on:
2828
- policy
2929
- proxy
3030
- regression
31+
- runtime-rs-tmp
3132
- servicemesh
3233
- vault
3334
- volumestatefulset

.github/workflows/e2e_nightly.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ jobs:
6767
- policy
6868
- proxy
6969
- regression
70+
- runtime-rs-tmp
7071
- servicemesh
7172
- vault
7273
- volumestatefulset
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: e2e test runtime-rs
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- overlays/sets/runtime-rs.nix
7+
- packages/by-name/kata/runtime/**
8+
- packages/by-name/kata/runtime-rs/**
9+
- e2e/runtime-rs-tmp/**
10+
11+
jobs:
12+
tests:
13+
strategy:
14+
matrix:
15+
platform:
16+
- name: Metal-QEMU-SNP
17+
runner: SNP
18+
self-hosted: true
19+
- name: Metal-QEMU-TDX
20+
runner: TDX
21+
self-hosted: true
22+
- name: Metal-QEMU-SNP-GPU
23+
runner: SNP-GPU
24+
self-hosted: true
25+
- name: Metal-QEMU-TDX-GPU
26+
runner: TDX-GPU
27+
self-hosted: true
28+
test-name:
29+
- runtime-rs-tmp
30+
fail-fast: false
31+
name: "${{ matrix.platform.name }}"
32+
uses: ./.github/workflows/e2e.yml
33+
with:
34+
skip-undeploy: false
35+
test-name: ${{ matrix.test-name }}
36+
platform: ${{ matrix.platform.name }}
37+
runner: ${{ matrix.platform.runner }}
38+
self-hosted: ${{ matrix.platform.self-hosted }}
39+
debug-shell: true
40+
secrets:
41+
GITHUB_TOKEN_IN: ${{ secrets.GITHUB_TOKEN }}
42+
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
43+
NUNKI_CI_COMMIT_PUSH_PR: ${{ secrets.NUNKI_CI_COMMIT_PUSH_PR }}
44+
TEAMS_CI_WEBHOOK: ${{ secrets.TEAMS_CI_WEBHOOK }}
45+
CONTRAST_GHCR_READ: ${{ secrets.CONTRAST_GHCR_READ }}
46+
permissions:
47+
contents: read
48+
packages: write
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright 2026 Edgeless Systems GmbH
2+
// SPDX-License-Identifier: BUSL-1.1
3+
4+
package runtimerstmp
5+
6+
import (
7+
"context"
8+
"flag"
9+
"os"
10+
"testing"
11+
"time"
12+
13+
"github.com/edgelesssys/contrast/e2e/internal/contrasttest"
14+
"github.com/edgelesssys/contrast/internal/kuberesource"
15+
"github.com/edgelesssys/contrast/internal/manifest"
16+
"github.com/edgelesssys/contrast/internal/platforms"
17+
"github.com/stretchr/testify/require"
18+
)
19+
20+
// TODO: remove when runtime-rs is fully integrated.
21+
// Right now there are some failures left, so we only test that we can start up a container.
22+
// Remove the test and use openssl and other tests when ready.
23+
24+
func TestRuntimeRS(t *testing.T) {
25+
platform, err := platforms.FromString(contrasttest.Flags.PlatformStr)
26+
require.NoError(t, err)
27+
28+
ct := contrasttest.New(t)
29+
30+
require.True(t, contrasttest.Flags.InsecureEnableDebugShell, "the --insecure-enable-debug-shell-access flag must be set to true to extract the initrd start address")
31+
32+
runtimeHandler, err := manifest.RuntimeHandler(platform)
33+
require.NoError(t, err)
34+
resources := kuberesource.CoordinatorBundle()
35+
resources = kuberesource.PatchRuntimeHandlers(resources, runtimeHandler)
36+
resources = kuberesource.AddPortForwarders(resources)
37+
ct.Init(t, resources)
38+
39+
require.True(t, t.Run("generate", ct.Generate), "contrast generate needs to succeed for subsequent tests")
40+
require.True(t, t.Run("apply", ct.Apply), "Kubernetes resources need to be applied for subsequent tests")
41+
42+
// 'set' currently errors because of wrong measurements, but the debugshell init container should come up.
43+
require.True(t, t.Run("wait for debugshell", func(t *testing.T) {
44+
ctx, cancel := context.WithTimeout(t.Context(), ct.FactorPlatformTimeout(2*time.Minute))
45+
defer cancel()
46+
require.NoError(t, ct.Kubeclient.WaitForContainer(ctx, ct.Namespace, "coordinator-0", "contrast-debug-shell"))
47+
}), "debugshell start must succeed for subsequent tests")
48+
}
49+
50+
func TestMain(m *testing.M) {
51+
contrasttest.RegisterFlags()
52+
flag.Parse()
53+
os.Exit(m.Run())
54+
}

packages/by-name/contrast/e2e/package.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ buildGoModule {
8181
"e2e/proxy"
8282
"e2e/regression"
8383
"e2e/release"
84+
"e2e/runtime-rs-tmp"
8485
"e2e/servicemesh"
8586
"e2e/vault"
8687
"e2e/volumestatefulset"

0 commit comments

Comments
 (0)