Skip to content

Commit

Permalink
fix: make test enclave creation support DNS label rules (#1202)
Browse files Browse the repository at this point in the history
## Description:
<!-- Describe this change, how it works, and the motivation behind it.
-->

## Is this change user facing?
YES/NO
<!-- If yes, please add the "user facing" label to the PR -->
<!-- If yes, don't forget to include docs changes where relevant -->

## References (if applicable):
<!-- Add relevant Github Issues, Discord threads, or other helpful
information. -->
  • Loading branch information
h4ck3rk3y committed Aug 30, 2023
1 parent c647035 commit df61ecc
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
8 changes: 3 additions & 5 deletions internal_testsuites/golang/test_helpers/enclave_setup.go
Expand Up @@ -12,19 +12,17 @@ import (
)

const (
testsuiteNameEnclaveIDFragment = "go-testsuite"

millisInNanos = 1000
testsuiteNameEnclaveIDFragment = "go-test"
)

func CreateEnclave(t *testing.T, ctx context.Context, testName string) (resultEnclaveCtx *enclaves.EnclaveContext, resultStopEnclaveFunc func(), resultDestroyEnclaveFunc func() error, resultErr error) {
kurtosisCtx, err := kurtosis_context.NewKurtosisContextFromLocalEngine()
require.NoError(t, err, "An error occurred connecting to the Kurtosis engine for running test '%v'", testName)
enclaveName := fmt.Sprintf(
"%v.%v.%v",
"%v-%v-%v",
testsuiteNameEnclaveIDFragment,
testName,
time.Now().UnixNano()/millisInNanos,
time.Now().Unix(),
)
enclaveCtx, err := kurtosisCtx.CreateEnclave(ctx, enclaveName)
require.NoError(t, err, "An error occurred creating enclave '%v'", enclaveName)
Expand Down
Expand Up @@ -11,7 +11,7 @@ import (
)

const (
testName = "starlark_exec_test"
testName = "starlark-exec"
)

const (
Expand Down
Expand Up @@ -9,7 +9,7 @@ import (
)

const (
testName = "startosis_remove_service_test"
testName = "remove-service"

serviceName = "example-datastore-server-1"
portId = "grpc"
Expand Down
Expand Up @@ -11,7 +11,7 @@ import (
)

const (
testName = "startosis_start_service_test"
testName = "start-service"

serviceName = "example-datastore-start-test"
portId = "grpc"
Expand Down
Expand Up @@ -11,7 +11,7 @@ import (
)

const (
testName = "startosis_stop_service_test"
testName = "starlark-stop-service"

serviceName = "example-datastore-stop-service"
portId = "grpc"
Expand Down
Expand Up @@ -2,7 +2,7 @@ import { EnclaveContext, EnclaveUUID, KurtosisContext } from "kurtosis-sdk"
import {Result, err, ok} from "neverthrow"
import log from "loglevel";

const TEST_SUITE_NAME_ENCLAVE_UUID_FRAGMENT = "ts-testsuite";
const TEST_SUITE_NAME_ENCLAVE_UUID_FRAGMENT = "ts-test";
const MILLISECONDS_IN_SECOND = 1000;

export async function createEnclave(testName:string):
Expand All @@ -19,7 +19,7 @@ export async function createEnclave(testName:string):
}
const kurtosisContext = newKurtosisContextResult.value;

const enclaveId:EnclaveUUID = `${TEST_SUITE_NAME_ENCLAVE_UUID_FRAGMENT}.${testName}.${Math.round(Date.now()/MILLISECONDS_IN_SECOND)}`
const enclaveId:EnclaveUUID = `${TEST_SUITE_NAME_ENCLAVE_UUID_FRAGMENT}-${testName}-${Math.round(Date.now()/MILLISECONDS_IN_SECOND)}`
const createEnclaveResult = await kurtosisContext.createEnclave(enclaveId);

if(createEnclaveResult.isErr()) {
Expand Down

0 comments on commit df61ecc

Please sign in to comment.