mirror of
https://github.com/zitadel/zitadel.git
synced 2025-03-01 17:27:24 +00:00
remove unused code
This commit is contained in:
parent
18a1e89dab
commit
03d2edc3ac
@ -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)
|
||||
}
|
||||
|
@ -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{})
|
||||
|
Loading…
x
Reference in New Issue
Block a user