Skip to content

Commit a01e8c2

Browse files
authored
Merge pull request #2159 from nebius/SCHED-863/e2e-binary
SCHED-863: Rewrite e2e tests to e2e binary
2 parents a49b60c + a0aad3a commit a01e8c2

File tree

11 files changed

+514
-459
lines changed

11 files changed

+514
-459
lines changed

.github/workflows/e2e_test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ jobs:
173173
fetch-depth: 0
174174

175175
- name: Terraform Apply
176+
timeout-minutes: 120
176177
run: |
177178
cd ${{ env.PATH_TO_INSTALLATION }}
178179
nebius iam session-management revoke --all-my-active
@@ -187,7 +188,7 @@ jobs:
187188
aws configure set region $NEBIUS_REGION
188189
aws configure set endpoint_url https://storage.$NEBIUS_REGION.nebius.cloud:443
189190
190-
go test -v -timeout 2h --tags=e2e -run TestTerraformApply ./test/e2e/...
191+
go run ./cmd/e2e apply
191192
192193
- name: K8s Cluster Info and NodeGroups
193194
if: always()
@@ -299,6 +300,7 @@ jobs:
299300

300301
- name: Terraform Destroy
301302
if: always()
303+
timeout-minutes: 30
302304
run: |
303305
cd ${{ env.PATH_TO_INSTALLATION }}
304306
source .envrc
@@ -310,7 +312,7 @@ jobs:
310312
aws configure set region $NEBIUS_REGION
311313
aws configure set endpoint_url https://storage.$NEBIUS_REGION.nebius.cloud:443
312314
313-
go test -v -timeout 30m --tags=e2e -run TestTerraformDestroy ./test/e2e/...
315+
go run ./cmd/e2e destroy
314316
315317
- name: Force cleanup compute instances on failure
316318
if: failure()

cmd/e2e/main.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package main
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"log"
7+
"os"
8+
"os/signal"
9+
"syscall"
10+
11+
"github.com/kelseyhightower/envconfig"
12+
13+
"nebius.ai/slurm-operator/internal/e2e"
14+
)
15+
16+
func main() {
17+
if len(os.Args) < 2 {
18+
_, _ = fmt.Fprintf(os.Stderr, "Usage: e2e <apply|destroy>\n")
19+
os.Exit(2)
20+
}
21+
22+
var cfg e2e.Config
23+
if err := envconfig.Process("", &cfg); err != nil {
24+
log.Fatalf("parse config: %v", err)
25+
}
26+
27+
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
28+
defer stop()
29+
30+
var err error
31+
switch os.Args[1] {
32+
case "apply":
33+
err = e2e.Apply(ctx, cfg)
34+
case "destroy":
35+
err = e2e.Destroy(ctx, cfg)
36+
default:
37+
_, _ = fmt.Fprintf(os.Stderr, "Unknown command: %s\nUsage: e2e <apply|destroy>\n", os.Args[1])
38+
os.Exit(2)
39+
}
40+
if err != nil {
41+
log.Fatalf("%s: %v", os.Args[1], err)
42+
}
43+
}

go.mod

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ require (
66
github.com/SlinkyProject/slurm-client v0.3.1-20250801102150-043094ce1e4e
77
github.com/go-logr/logr v1.4.3
88
github.com/golang-jwt/jwt/v5 v5.3.0
9-
github.com/gruntwork-io/terratest v0.54.0
109
github.com/hashicorp/go-retryablehttp v0.7.8
1110
github.com/hashicorp/hcl/v2 v2.22.0
11+
github.com/hashicorp/terraform-exec v0.24.0
12+
github.com/hashicorp/terraform-json v0.27.2
1213
github.com/kelseyhightower/envconfig v1.4.0
1314
github.com/kubereboot/kured v0.0.0-20241106074119-94e73465adc3
1415
github.com/mackerelio/go-osstat v0.2.6
@@ -39,7 +40,6 @@ require (
3940
github.com/agext/levenshtein v1.2.3 // indirect
4041
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
4142
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
42-
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
4343
github.com/blang/semver/v4 v4.0.0 // indirect
4444
github.com/cert-manager/cert-manager v1.18.2 // indirect
4545
github.com/containers/common v0.60.4 // indirect
@@ -50,18 +50,8 @@ require (
5050
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
5151
github.com/google/btree v1.1.3 // indirect
5252
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
53-
github.com/hashicorp/errwrap v1.1.0 // indirect
5453
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
55-
github.com/hashicorp/go-getter/v2 v2.2.3 // indirect
56-
github.com/hashicorp/go-multierror v1.1.1 // indirect
57-
github.com/hashicorp/go-safetemp v1.0.0 // indirect
5854
github.com/hashicorp/go-version v1.7.0 // indirect
59-
github.com/hashicorp/terraform-json v0.23.0 // indirect
60-
github.com/jinzhu/copier v0.4.0 // indirect
61-
github.com/klauspost/compress v1.18.0 // indirect
62-
github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326 // indirect
63-
github.com/mitchellh/go-homedir v1.1.0 // indirect
64-
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
6555
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
6656
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
6757
github.com/oapi-codegen/runtime v1.1.1 // indirect
@@ -76,9 +66,7 @@ require (
7666
github.com/sethvargo/go-envconfig v1.3.0 // indirect
7767
github.com/sirupsen/logrus v1.9.3 // indirect
7868
github.com/stretchr/objx v0.5.2 // indirect
79-
github.com/tmccombs/hcl2json v0.6.4 // indirect
8069
github.com/ugorji/go/codec v1.2.12 // indirect
81-
github.com/ulikunitz/xz v0.5.14 // indirect
8270
github.com/x448/float16 v0.8.4 // indirect
8371
go.opentelemetry.io/otel v1.35.0 // indirect
8472
go.opentelemetry.io/otel/trace v1.35.0 // indirect
@@ -130,7 +118,7 @@ require (
130118
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
131119
google.golang.org/protobuf v1.36.8 // indirect
132120
gopkg.in/inf.v0 v0.9.1 // indirect
133-
gopkg.in/yaml.v3 v3.0.1
121+
gopkg.in/yaml.v3 v3.0.1 // indirect
134122
k8s.io/apiextensions-apiserver v0.34.2 // indirect
135123
k8s.io/klog/v2 v2.130.1
136124
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect

0 commit comments

Comments
 (0)