remove unused code

This commit is contained in:
Florian Forster 2025-02-19 12:51:17 +01:00
parent 18a1e89dab
commit 03d2edc3ac
No known key found for this signature in database
2 changed files with 0 additions and 37 deletions

View File

@ -26,23 +26,10 @@ var (
)
var (
tmpDir string
loadedConfig Config
)
// TmpDir returns the absolute path to the projects's temp directory.
func TmpDir() string {
return tmpDir
}
func init() {
cmd := exec.Command("git", "rev-parse", "--show-toplevel")
out, err := cmd.Output()
if err != nil {
panic(err)
}
tmpDir = filepath.Join(string(bytes.TrimSpace(out)), "tmp")
if err := yaml.Unmarshal(clientYAML, &loadedConfig); err != nil {
panic(err)
}

View File

@ -97,22 +97,6 @@ type Instance struct {
WebAuthN *webauthn.Client
}
// GetFirstInstance returns the default instance and org information,
// with authorized machine users.
// Using the first instance is not recommended as parallel test might
// interfere with each other.
// It is recommended to use [NewInstance] instead.
func GetFirstInstance(ctx context.Context) *Instance {
i := &Instance{
Config: loadedConfig,
Domain: loadedConfig.Hostname,
}
token := loadInstanceOwnerPAT()
i.setClient(ctx)
i.setupInstance(ctx, token)
return i
}
// NewInstance returns a new instance that can be used for integration tests.
// The instance contains a gRPC client connected to the domain of this instance.
// The included users are the IAM_OWNER, ORG_OWNER of the default org and
@ -206,14 +190,6 @@ func (i *Instance) Host() string {
return fmt.Sprintf("%s:%d", i.Domain, i.Config.Port)
}
func loadInstanceOwnerPAT() string {
data, err := os.ReadFile(filepath.Join(tmpDir, adminPATFile))
if err != nil {
panic(err)
}
return string(bytes.TrimSpace(data))
}
func (i *Instance) createMachineUserInstanceOwner(ctx context.Context, token string) {
mustAwait(func() error {
user, err := i.Client.Auth.GetMyUser(WithAuthorizationToken(ctx, token), &auth.GetMyUserRequest{})