Skip to content

Commit aaac0df

Browse files
committed
chore: trim unused runtime helpers
1 parent 6e4faeb commit aaac0df

6 files changed

Lines changed: 16 additions & 72 deletions

File tree

apps/druid/adapters/cli/output.go

Lines changed: 0 additions & 15 deletions
This file was deleted.

internal/runtime/docker/backend.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -520,14 +520,6 @@ func dataRootHash(dataRoot string) string {
520520
return hex.EncodeToString(hash[:])[:10]
521521
}
522522

523-
func commandProcedureName(commandName string, idx int, procedure *domain.Procedure) string {
524-
procedureName := fmt.Sprintf("%s.%d", commandName, idx)
525-
if procedure != nil && procedure.Id != nil {
526-
procedureName = *procedure.Id
527-
}
528-
return procedureName
529-
}
530-
531523
func runtimeConsoleID(scrollID string, procedureName string) string {
532524
if scrollID == "" {
533525
return procedureName

internal/runtime/kubernetes/backend.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -961,14 +961,6 @@ func portsByName(ports []domain.Port) map[string]domain.Port {
961961
return result
962962
}
963963

964-
func commandProcedureName(commandName string, idx int, procedure *domain.Procedure) string {
965-
procedureName := fmt.Sprintf("%s.%d", commandName, idx)
966-
if procedure != nil && procedure.Id != nil {
967-
procedureName = *procedure.Id
968-
}
969-
return procedureName
970-
}
971-
972964
func runtimeConsoleID(scrollID string, procedureName string) string {
973965
if scrollID == "" {
974966
return procedureName

test/integration/docker/docker_cli_test.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ func TestDockerBackendCLIComplexLifecycle(t *testing.T) {
5353

5454
e2e.RunClient(t, bins, socket, "run", created.ID, "record")
5555
dataRoot := filepath.Join(stateDir, "scrolls", created.ID, "data")
56-
assertFileContains(t, filepath.Join(dataRoot, "finite.txt"), "finite-ok")
56+
if got := readFile(t, filepath.Join(dataRoot, "finite.txt")); !strings.Contains(got, "finite-ok") {
57+
t.Fatalf("finite file = %q, want finite-ok", got)
58+
}
5759
recordEnv := e2e.ParseEnv(readFile(t, filepath.Join(dataRoot, "record-env.txt")))
5860
e2e.AssertRuntimeEnv(t, recordEnv, fixture, "docker", created.ID)
5961
if recordEnv["USER_ENV"] != "finite" {
@@ -84,14 +86,6 @@ func assertPortBound(t *testing.T, statuses []e2e.RuntimePortStatus, fixture e2e
8486
t.Fatalf("http port for %s not found in %#v", fixture.ServeProc, statuses)
8587
}
8688

87-
func assertFileContains(t *testing.T, path string, want string) {
88-
t.Helper()
89-
got := readFile(t, path)
90-
if !strings.Contains(got, want) {
91-
t.Fatalf("%s = %q, want to contain %q", path, got, want)
92-
}
93-
}
94-
9589
func readFile(t *testing.T, path string) string {
9690
t.Helper()
9791
data, err := os.ReadFile(path)

test/integration/internal/e2e/harness.go

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,20 @@ type Binaries struct {
2525
}
2626

2727
type Fixture struct {
28-
Dir string
29-
Name string
30-
ServeProc string
31-
RecordProc string
32-
Port int
33-
RouteHost string
34-
RouteURL string
35-
RoutePort int
36-
RoutingFile string
37-
Assignment string
38-
ScrollRootRef string
28+
Dir string
29+
Name string
30+
ServeProc string
31+
RecordProc string
32+
Port int
33+
RouteHost string
34+
RouteURL string
35+
RoutePort int
36+
RoutingFile string
3937
}
4038

4139
type RuntimeScroll struct {
42-
ID string `json:"id"`
43-
DataRoot string `json:"data_root"`
44-
ScrollName string `json:"scroll_name"`
45-
Status string `json:"status"`
40+
ID string `json:"id"`
41+
Status string `json:"status"`
4642
}
4743

4844
type RuntimePortStatus struct {
@@ -51,14 +47,11 @@ type RuntimePortStatus struct {
5147
Port int `json:"port"`
5248
Bound bool `json:"bound"`
5349
HostPort int `json:"host_port"`
54-
Source string `json:"source"`
5550
}
5651

5752
type RuntimeRoutingTarget struct {
58-
Name string `json:"name"`
5953
Procedure string `json:"procedure"`
6054
PortName string `json:"port_name"`
61-
Port int `json:"port"`
6255
Namespace string `json:"namespace"`
6356
ServiceName string `json:"service_name"`
6457
ServicePort int `json:"service_port"`
@@ -289,7 +282,6 @@ commands:
289282
RouteURL: routeURL,
290283
RoutePort: routePort,
291284
RoutingFile: routingFile,
292-
Assignment: serveProc + "-http",
293285
}
294286
}
295287

test/integration/kubernetes/kubernetes_cli_test.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ func TestKubernetesBackendCLIComplexLifecycle(t *testing.T) {
2626
ref := fmt.Sprintf("k8s://%s/%s", namespace, pvc)
2727
name := "k8s-cli-" + suffix
2828
fixture := e2e.WriteFixture(t, filepath.Join(t.TempDir(), "scroll"), name, port, routePort)
29-
fixture.ScrollRootRef = ref
3029

3130
e2e.Run(t, "kubectl", "create", "namespace", namespace)
3231
t.Cleanup(func() {
@@ -94,12 +93,12 @@ func TestKubernetesBackendCLIComplexLifecycle(t *testing.T) {
9493
if stopped.Status != "stopped" {
9594
t.Fatalf("stopped status = %s, want stopped", stopped.Status)
9695
}
97-
waitKubernetesWorkloadsGone(t, namespace, pvc)
96+
waitKubernetesResourcesGone(t, namespace, pvc, "statefulset,job,pod")
9897
deleted := e2e.RunClient(t, bins, socket, "delete", created.ID)
9998
if !strings.Contains(deleted, `"status": "deleted"`) {
10099
t.Fatalf("delete response = %s, want deleted status", deleted)
101100
}
102-
waitKubernetesServicesGone(t, namespace, pvc)
101+
waitKubernetesResourcesGone(t, namespace, pvc, "service")
103102
}
104103

105104
func requireKubernetes(t *testing.T) {
@@ -313,16 +312,6 @@ func kubectlOutput(args ...string) (string, error) {
313312
return string(out), err
314313
}
315314

316-
func waitKubernetesWorkloadsGone(t *testing.T, namespace string, pvc string) {
317-
t.Helper()
318-
waitKubernetesResourcesGone(t, namespace, pvc, "statefulset,job,pod")
319-
}
320-
321-
func waitKubernetesServicesGone(t *testing.T, namespace string, pvc string) {
322-
t.Helper()
323-
waitKubernetesResourcesGone(t, namespace, pvc, "service")
324-
}
325-
326315
func waitKubernetesResourcesGone(t *testing.T, namespace string, pvc string, resource string) {
327316
t.Helper()
328317
selector := "app.kubernetes.io/managed-by=druid,druid.gg/scroll-id=" + pvc

0 commit comments

Comments
 (0)