stress_testing

package
v0.0.0-...-b9085d8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Copyright (C) 2020 Synopsys, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (C) 2020 Synopsys, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (C) 2020 Synopsys, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (C) 2020 Synopsys, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Reauthenticator

func Reauthenticator(polarisClient *api.Client, stop <-chan struct{})

func Run

func Run(configPath string)

func RunLoadGenerator

func RunLoadGenerator(config *Config) (*IssueServerLoadGenerator, *AuthLoadGenerator, error)

func RunLoginsForUsers

func RunLoginsForUsers(client *api.Client, userCount int) error

func RunRateLimiterTests

func RunRateLimiterTests()

Types

type AdaptiveRateAdjuster

type AdaptiveRateAdjuster func(currentLimit float64, currentRate float64, currentErrorFraction float64) float64

type AuthConfig

type AuthConfig struct {
	PreRunLogins                 int
	Entitlements                 *LoadConfig
	Login                        *LoadConfig
	RoleAssignmentsPager         map[string]*RoleAssignmentsPager
	RoleAssignmentsSingleProject *LoadConfig
	CreateRoleAssignments        *LoadConfig
}

type AuthLoadGenerator

type AuthLoadGenerator struct {
	Config *AuthConfig
	// contains filtered or unexported fields
}

func NewAuthLoadGenerator

func NewAuthLoadGenerator(projects *ProjectFetcher, url string, email string, password string, config *AuthConfig) *AuthLoadGenerator

func (*AuthLoadGenerator) Stop

func (alg *AuthLoadGenerator) Stop()

type BaseRateSetter

type BaseRateSetter = func(float64) float64

func Add

func Add(fs ...BaseRateSetter) BaseRateSetter

func AmplitudeFromArray

func AmplitudeFromArray(vals []float64, durationSeconds float64) BaseRateSetter

func Const

func Const(baseline float64) BaseRateSetter

func Linear

func Linear(slope float64) BaseRateSetter

func Piecewise

func Piecewise(pieces []*Piece) BaseRateSetter

func ShiftRight

func ShiftRight(seconds float64, f BaseRateSetter) BaseRateSetter

func Sinusoid

func Sinusoid(baseline float64, amplitude float64, period float64, phase float64) BaseRateSetter

func Spike

func Spike(baseline float64, lowDuration float64, height float64, highDuration float64, ramp float64) BaseRateSetter

type Config

type Config struct {
	PolarisURL      string
	PolarisEmail    string
	PolarisPassword string

	LogLevel string

	Port int

	LoadGenerator struct {
		Issue *IssueServerConfig
		Auth  *AuthConfig
	}
}

func GetConfig

func GetConfig(configPath string) (*Config, error)

GetConfig ...

func (*Config) GetLogLevel

func (config *Config) GetLogLevel() (log.Level, error)

GetLogLevel ...

type ErrorFractionThresholdConfig

type ErrorFractionThresholdConfig struct {
	IncreaseRatio            float64
	IncreaseMaxErrorFraction float64
	DecreaseRatio            float64
	DecreaseMinErrorFraction float64
	MaxRate                  float64
	MinRate                  float64
}

func (*ErrorFractionThresholdConfig) RateAdjuster

type FuncJobSource

type FuncJobSource struct {
	// contains filtered or unexported fields
}

func (*FuncJobSource) RunJob

func (fjs *FuncJobSource) RunJob() (string, error)

type IssueServerConfig

type IssueServerConfig struct {
	FetchProjectsCount int

	Issues       *LoadConfig
	RollupCounts *RollupCountsPager
}

type IssueServerLoadGenerator

type IssueServerLoadGenerator struct {
	Config *IssueServerConfig
	// contains filtered or unexported fields
}

func NewIssueServerLoadGenerator

func NewIssueServerLoadGenerator(polarisClient *api.Client, projects *ProjectFetcher, config *IssueServerConfig) *IssueServerLoadGenerator

func (*IssueServerLoadGenerator) Stop

func (c *IssueServerLoadGenerator) Stop()

type IssuesSource

type IssuesSource struct {
	Projects *ProjectFetcher
	Offset   int
	Index    int
	// contains filtered or unexported fields
}

func NewIssuesSource

func NewIssuesSource(client *api.Client, projects *ProjectFetcher, start int) *IssuesSource

func (*IssuesSource) RunJob

func (is *IssuesSource) RunJob() (string, error)

type JobSource

type JobSource interface {
	// RunJob must be synchronous and reentrant
	RunJob() (string, error)
}

type LoadConfig

type LoadConfig struct {
	WorkersCount int
	Rate         *RateConfig
}

type LoadManager

type LoadManager struct {
	Name string
	// contains filtered or unexported fields
}

func NewLoadManager

func NewLoadManager(name string, js JobSource, workerCount int, rateLimiter *RateLimiter) *LoadManager

type LoadWorker

type LoadWorker struct {
	WorkerId string
	// contains filtered or unexported fields
}

func NewLoadWorker

func NewLoadWorker(runJob func(), workerId string) *LoadWorker

type MainBranchProject

type MainBranchProject struct {
	ProjectId    string
	MainBranchId string
}

type Piece

type Piece struct {
	DurationSeconds float64
	BaseRateSetter  BaseRateSetter
}

type PostRoleAssignmentsSource

type PostRoleAssignmentsSource struct {
	Name string
	// contains filtered or unexported fields
}

func NewPostRoleAssignmentsSource

func NewPostRoleAssignmentsSource(name string, client *api.Client) (*PostRoleAssignmentsSource, error)

func (*PostRoleAssignmentsSource) RunJob

func (pras *PostRoleAssignmentsSource) RunJob() (string, error)

type ProjectFetcher

type ProjectFetcher struct {
	StartIndex int
	Limit      int
	// contains filtered or unexported fields
}

func NewProjectFetcher

func NewProjectFetcher(client *api.Client, start int, limit int) *ProjectFetcher

func NewProjectFetcherWithRandomStart

func NewProjectFetcherWithRandomStart(client *api.Client, limit int) *ProjectFetcher

func (*ProjectFetcher) GetMainBranchProject

func (pf *ProjectFetcher) GetMainBranchProject(index int) *MainBranchProject

func (*ProjectFetcher) GetProject

func (pf *ProjectFetcher) GetProject(index int) *api.VinylV0Project

func (*ProjectFetcher) IsDone

func (pf *ProjectFetcher) IsDone() bool

func (*ProjectFetcher) MainBranchProjectsLength

func (pf *ProjectFetcher) MainBranchProjectsLength() int

func (*ProjectFetcher) ProjectsLength

func (pf *ProjectFetcher) ProjectsLength() int

func (*ProjectFetcher) Start

func (pf *ProjectFetcher) Start()

func (*ProjectFetcher) Stop

func (pf *ProjectFetcher) Stop()

type RateConfig

type RateConfig struct {
	RateChangePeriodSeconds float64
	Constant                *struct {
		Baseline float64
	}
	Sinusoid *struct {
		Baseline  float64
		Amplitude float64
		Period    float64
		Phase     float64
	}
	Spike *struct {
		Baseline          float64
		LowPeriodSeconds  float64
		Height            float64
		HighPeriodSeconds float64
		RampSeconds       float64
	}
	AdaptiveRateAdjuster *ErrorFractionThresholdConfig
}

func (*RateConfig) MustRateLimiter

func (rc *RateConfig) MustRateLimiter(name string) *RateLimiter

func (*RateConfig) RateSetter

func (rc *RateConfig) RateSetter() (BaseRateSetter, error)

type RateLimiter

type RateLimiter struct {
	Name string
	// contains filtered or unexported fields
}

func NewRateLimiter

func NewRateLimiter(name string, getRate BaseRateSetter, rateChangePeriod time.Duration, errorAdjuster AdaptiveRateAdjuster) *RateLimiter

func (*RateLimiter) Finish

func (rl *RateLimiter) Finish(desc string, err error)

func (*RateLimiter) Limit

func (rl *RateLimiter) Limit() float64

func (*RateLimiter) Stop

func (rl *RateLimiter) Stop()

func (*RateLimiter) Wait

func (rl *RateLimiter) Wait()

type RoleAssignmentsPager

type RoleAssignmentsPager struct {
	LoadConfig *LoadConfig
	PageSize   int
}

type RoleAssignmentsPagerSource

type RoleAssignmentsPagerSource struct {
	Page int

	Name     string
	PageSize int
	// contains filtered or unexported fields
}

func NewRoleAssignmentsPagerSource

func NewRoleAssignmentsPagerSource(name string, client *api.Client, start int, pageSize int) *RoleAssignmentsPagerSource

func (*RoleAssignmentsPagerSource) RunJob

func (raps *RoleAssignmentsPagerSource) RunJob() (string, error)

type RoleAssignmentsSingleProjectSource

type RoleAssignmentsSingleProjectSource struct {
	Index int
	// contains filtered or unexported fields
}

func NewRoleAssignmentsSingleProjectSource

func NewRoleAssignmentsSingleProjectSource(client *api.Client, projects *ProjectFetcher) *RoleAssignmentsSingleProjectSource

func (*RoleAssignmentsSingleProjectSource) RunJob

type RollupCountsPager

type RollupCountsPager struct {
	LoadConfig *LoadConfig
	PageSize   int
}

type RollupCountsSource

type RollupCountsSource struct {
	Projects *ProjectFetcher
	Index    int
	Limit    int
	// contains filtered or unexported fields
}

func NewRollupCountsSource

func NewRollupCountsSource(client *api.Client, projects *ProjectFetcher, start int, limit int) *RollupCountsSource

func (*RollupCountsSource) RunJob

func (rcs *RollupCountsSource) RunJob() (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL