mirror of
https://github.com/zitadel/zitadel.git
synced 2025-03-01 16:47:24 +00:00
remove unused code
This commit is contained in:
parent
18a1e89dab
commit
03d2edc3ac
@ -26,23 +26,10 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
tmpDir string
|
|
||||||
loadedConfig Config
|
loadedConfig Config
|
||||||
)
|
)
|
||||||
|
|
||||||
// TmpDir returns the absolute path to the projects's temp directory.
|
|
||||||
func TmpDir() string {
|
|
||||||
return tmpDir
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
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 {
|
if err := yaml.Unmarshal(clientYAML, &loadedConfig); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -97,22 +97,6 @@ type Instance struct {
|
|||||||
WebAuthN *webauthn.Client
|
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.
|
// 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 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
|
// 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)
|
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) {
|
func (i *Instance) createMachineUserInstanceOwner(ctx context.Context, token string) {
|
||||||
mustAwait(func() error {
|
mustAwait(func() error {
|
||||||
user, err := i.Client.Auth.GetMyUser(WithAuthorizationToken(ctx, token), &auth.GetMyUserRequest{})
|
user, err := i.Client.Auth.GetMyUser(WithAuthorizationToken(ctx, token), &auth.GetMyUserRequest{})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user