...

Package bslauth

import "edge-infra.dev/test/f2/x/bslauth"
Overview
Index

Overview ▾

Package bslauth implements an f2 extension for working with BSL credentials

Usage

BSL test user credentials for each environment (dev1, stage1, stage2) are stored in the test-infra4 secret manager and mounted onto the rosa container as part of the dsds nightly test runs.

Add bslauth extension to test framework with `f2.WithExtensions(bslauth.New())`

In test access credential values as below:

auth = bslauth.FromContextT(ctx, t)
bsluser = auth.User(bslauth.BannerAdmin)

username := bsluser.Username
password := bsluser.Password
organization := bsluser.organization

type BSLAuth

type BSLAuth struct {
    APIEndpoint string
    // contains filtered or unexported fields
}

func FromContext

func FromContext(ctx fctx.Context) (*BSLAuth, error)

func FromContextT

func FromContextT(ctx fctx.Context, t *testing.T) *BSLAuth

func New

func New() *BSLAuth

func (*BSLAuth) BindFlags

func (b *BSLAuth) BindFlags(fs *flag.FlagSet)

BindFlags registers test flags for the framework extension.

func (*BSLAuth) IntoContext

func (b *BSLAuth) IntoContext(ctx fctx.Context) fctx.Context

IntoContext stores the framework extension in the test context.

func (*BSLAuth) RegisterFns

func (b *BSLAuth) RegisterFns(f f2.Framework)

func (*BSLAuth) User

func (b *BSLAuth) User(id Identifier) User

Finds the User login details in the current env given an identifier

type Identifier

Identifier is a consistent way of referring to users across multiple edge environments. A user with a given Identifier will have the same roles across multiple environments, even if the login details change.

type Identifier string

All currently configured users

const (
    BannerAdmin Identifier = "banner-admin" // Identifies an user with the banner admin role
)

type User

User holds the Edge Login details for an user in the given environment

type User struct {
    Username string
    Password string
    Org      string `json:"organization"`
}