db

package
v0.0.0-...-ce299e0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SourceName string

SourceName is the database source name

Functions

func AddLabelToTest

func AddLabelToTest(testID string, label string) error

func CreateGrid

func CreateGrid(name string, provider string, region string, masterInstance string, slaveInstance string, slaveNumber int, ttl int, user string)

func CreateTest

func CreateTest(test Test, user string) (string, error)

func CreateTestFiles

func CreateTestFiles(testFiles TestFiles, id string, user string) (string, error)

func DeleteGridByID

func DeleteGridByID(id string) error

DeleteGridByID should Check the status of the Grid. If a test is deployed on it then special delete process would need to be kicked off. Make db status change to the test. If deployed but no tests are on it then change TTL tag so it gets deleted. Mark as deleted in DB so it doesn't show up anymore in the UI.

current possible grid status: Ready, Error, Deploying, Deployed, Destroyed, Deleted

func DeleteGridTemplate

func DeleteGridTemplate(id string) error

func DeleteLabelFromTest

func DeleteLabelFromTest(testID string, label string) error

func DeleteTest

func DeleteTest(id string)

func DeleteTestAttachment

func DeleteTestAttachment(ID string) error

func DeleteTestByID

func DeleteTestByID(id string) error

DeleteTestByID Mark the test in the DB as deleted so they do not show up in the UI.

Possibly delete all the data associated to the test and remove from the DB?

Possible states a test can be in: Ready, Creating, Uploading, Queued, Deploying, Deployed, Launching, Launched, Running, Stopping, Stopped, Missing info, Upload Failed, Error

func DuplicateTest

func DuplicateTest(testID string) (string, error)

func EditTestDescription

func EditTestDescription(id string, description string) error

func EditTestResult

func EditTestResult(id string, result string) error

EditTestResult will edit the test to a specified result

func EditTestTitle

func EditTestTitle(id string, title string) error

func GetAllInstanceTypes

func GetAllInstanceTypes() ([]byte, error)

func GetFirstGrid

func GetFirstGrid() (string, error)

func GetFirstTest

func GetFirstTest(startDate time.Time, endDate time.Time, search string) (string, error)

func GetGridByID

func GetGridByID(id string) ([]byte, error)

func GetGridByTestID

func GetGridByTestID(testID string) (string, string, error)

GetGridByTestID returns the grid assigned to the test, if no grid is assigned it will return a blank string with no error

func GetGridInstances

func GetGridInstances(provider string, region string) ([]byte, error)

func GetGridProviders

func GetGridProviders() ([]byte, error)

func GetGridRegion

func GetGridRegion(id string) (string, error)

GetGridRegion input the grid id and it returns the grid's region

func GetGridRegions

func GetGridRegions(provider string) ([]byte, error)

func GetGridStatus

func GetGridStatus(id string) (string, error)

GetGridStatus input the grid id and returns the grid's status

func GetGrids

func GetGrids(limit int) ([]byte, error)

func GetGridsByStatus

func GetGridsByStatus(statusList ...string) ([]byte, error)

GetGridsByStatus returns a list of grids based on status

func GetLastGrid

func GetLastGrid() (string, error)

func GetLastTest

func GetLastTest(startDate time.Time, endDate time.Time, search string) (string, error)

func GetNumberOfGrids

func GetNumberOfGrids() (int, error)

func GetNumberOfTests

func GetNumberOfTests(startDate time.Time, endDate time.Time, search string) (int, error)

func GetScriptFilename

func GetScriptFilename(id string) (string, string, error)

func GetScriptInfo

func GetScriptInfo(testID string) (string, string, error)

func GetTestAttachmentName

func GetTestAttachmentName(ID string) (string, error)

func GetTestAttachments

func GetTestAttachments(testID string) ([]byte, error)

func GetTestByGridID

func GetTestByGridID(gridID string) (string, error)

GetTestByGridID returns the grid assigned to the test, if no grid is assigned it will return a blank string with no error

func GetTestFiles

func GetTestFiles(id string) ([]byte, error)

test file details: filename STRING, filesize INT, last_modified TIMESTAMP,

func GetTestsByStatus

func GetTestsByStatus(statusList []string) ([]byte, error)

GetTestsByStatus get all tests that have a status within the list

func GrafanaSnapshot

func GrafanaSnapshot(testID, snapshotURL, snapshotDeleteURL string) error

GrafanaSnapshot saves snapshot links into the database

func GridGetPaginateKey

func GridGetPaginateKey(testID string, offset int) (string, error)

func GridPaginate

func GridPaginate(testID string, itemsPerPage int) ([]byte, error)

func InfoForGrafana

func InfoForGrafana(testID string) (name, gridID string, startTime, endTime time.Time, err error)

InfoForGrafana returns the data needed by grafana to create a snapshot.

func LatestTests

func LatestTests(limit int, startDate time.Time, endDate time.Time, search string) ([]byte, error)

func PutTestAttachment

func PutTestAttachment(testID string, filename string) error

func RefreshTestStatus

func RefreshTestStatus() error

RefreshTestStatus is used to make sure the test are in the correct status

func Set

func Set()

Set is to connect to the database

func TestByID

func TestByID(id string) ([]byte, error)

func TestGetPaginateKey

func TestGetPaginateKey(testID string, startDate time.Time, endDate time.Time, search string, offset int) (string, error)

if an offset of -5 is given, then the test key is given that would allow you to make a call for the previous page with an itemcount of 5.

positive offset is typically not used but is provided, not typically used because to go a page forward you just need to provide the last item in the current list.

func TestPaginate

func TestPaginate(testID string, startDate time.Time, endDate time.Time, search string, itemsPerPage int) ([]byte, error)

func UpdateGridStatus

func UpdateGridStatus(id string, status string) error

func UpdateGridTemplate

func UpdateGridTemplate(id string, gridTemplate GridTemplate) error

func UpdateTestIDinGrid

func UpdateTestIDinGrid(gridID string, testID string) error

UpdateTestIDinGrid is used to update the test id that is associated with a grid.

func UpdateTestStatus

func UpdateTestStatus(id string, status string) error

UpdateTestStatus should be used whenever updating a test status. It has special logic to add timestamps depending on the status being set.

func UpdateTestStatusThatUsesGrid

func UpdateTestStatusThatUsesGrid(gridid string, status string) (string, error)

UpdateTestStatusThatUsesGrid makes a call to get the test id associated to the grid id it then makes a call to the function that updates test status.

Types

type GridStruct

type GridStruct struct {
	ID       string
	Name     string
	Status   string
	TTL      string
	Provider string
	Region   string
	Master   string
	Slave    string
	Nodes    string
}

type GridTemplate

type GridTemplate struct {
	ID       string
	Name     string
	TTL      int
	Provider string
	Region   string
	Master   string `json:"MasterType" db:"master_type"`
	Slave    string `json:"SlaveType" db:"slave_type"`
	Nodes    int    `json:"SlaveNodes" db:"slave_nodes"`
}

func CreateGridTemplate

func CreateGridTemplate(gridTemplate GridTemplate) (GridTemplate, error)

func GetAllGridTemplates

func GetAllGridTemplates() ([]GridTemplate, error)

func GetGridTemplateById

func GetGridTemplateById(id string) (GridTemplate, error)

type InstanceType

type InstanceType struct {
	Name string
}

type Provider

type Provider struct {
	Name    string
	Regions []Region
}

type Region

type Region struct {
	Name          string
	InstanceTypes []InstanceType
}

type Test

type Test struct {
	ID          string
	Name        string
	Desc        string
	Status      string
	Labels      []string
	Result      string
	Created     string
	Launched    string
	Stopped     string
	SnapshotURL string
}

type TestFile

type TestFile struct {
	FileName string
	Size     uint32
	Modified time.Time
}

type TestFiles

type TestFiles struct {
	ID    string
	Name  string
	Files []TestFile
}

Jump to

Keyboard shortcuts

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