Documentation
¶
Index ¶
- func Login() error
- func Logout(accessToken string, apiURL string) error
- type AuthRequest
- type AuthResponse
- type CascadedTestConfig
- type FileCreation
- type HttpError
- type HttpRequest
- type HttpResponse
- type ProgramConfig
- type ServerConfig
- type StageTestInfo
- type SubmissionRequest
- type SubmissionResult
- type Test
- type TestCleanup
- type TestConfig
- type TestFailure
- type TestResult
- type TestSetup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthRequest ¶
type AuthRequest struct {
Otp string `json:"otp"`
}
type AuthResponse ¶
type AuthResponse struct {
AccessToken string `json:"accessToken"`
RefreshToken string `json:"refreshToken"`
ExpiresIn int `json:"expiresIn"`
UserId int `json:"userId"`
Username string `json:"username"`
Email string `json:"email"`
}
func LoginWithCode ¶
func LoginWithCode(otp string, apiURL string) (*AuthResponse, error)
func RefreshToken ¶
func RefreshToken(refreshToken string, apiURL string) (*AuthResponse, error)
type CascadedTestConfig ¶
type CascadedTestConfig struct {
TargetStageUuid string `json:"targetStageUuid"`
TargetStageNumber int `json:"targetStageNumber"`
StagesToRun []StageTestInfo `json:"stagesToRun"`
}
CascadedTestConfig represents test configurations for multiple stages When requesting stage X, this contains tests for stages 1..X
func FetchCascadedTests ¶
func FetchCascadedTests(stageUuid string, cfg *config.Config) (*CascadedTestConfig, error)
FetchCascadedTests fetches test configurations for all prerequisite stages When requesting stage X, this returns tests for stages 1..X to ensure backward compatibility
type FileCreation ¶
Define a new struct for the file items
type HttpRequest ¶
type HttpResponse ¶
type ProgramConfig ¶
type ProgramConfig struct {
Executable string `json:"executable"`
Args []string `json:"args"`
Env map[string]string `json:"env"`
}
ProgramConfig defines how to run the user's program for HTTP tests
type ServerConfig ¶
ServerConfig defines the server parameters for HTTP tests
type StageTestInfo ¶
type SubmissionRequest ¶
type SubmissionRequest struct {
StageUuid string `json:"stageUuid"`
Language string `json:"language"`
TestResults []TestResult `json:"testResults"`
TargetStageNumber *int `json:"targetStageNumber"`
}
type SubmissionResult ¶
type SubmissionResult struct {
Passed bool `json:"passed"`
TotalTests int `json:"totalTests"`
PassedTests int `json:"passedTests"`
FailedTests int `json:"failedTests"`
Feedback string `json:"feedback"`
TestFailures []TestFailure `json:"testFailures"`
}
func SubmitResults ¶
func SubmitResults(stageUuid string, language string, cfg *config.Config, results []TestResult, targetStageNumber *int) (*SubmissionResult, error)
type Test ¶
type Test struct {
TestName string `json:"testName"`
Stdin string `json:"stdin"`
TimeoutSeconds int `json:"timeoutSeconds"`
// in case testType is "http_server"
HttpRequests []HttpRequest `json:"httpRequests"`
// Setup and cleanup operations
Setup *TestSetup `json:"setup"`
Cleanup *TestCleanup `json:"cleanup"`
}
type TestCleanup ¶
type TestCleanup struct {
DeleteDirs []string `json:"deleteDirs"`
DeleteFiles []string `json:"deleteFiles"`
}
TestCleanup defines operations to perform after running a test
type TestConfig ¶
type TestConfig struct {
StageName string `json:"stageName"`
TestType string `json:"testType"` // "cli_interactive" or "http_server"
ProgramConfig *ProgramConfig `json:"programConfig"`
ServerConfig *ServerConfig `json:"serverConfig"`
Tests []Test `json:"tests"`
}
func FetchTests ¶
func FetchTests(stageUuid string, cfg *config.Config) (*TestConfig, error)
FetchTests is kept for backward compatibility but now uses the cascaded endpoint Returns only the tests for the requested stage
func ParseStageTests ¶
func ParseStageTests(stageInfo StageTestInfo) (*TestConfig, error)
ParseStageTests parses the test config JSON string for a single stage
type TestFailure ¶
type TestResult ¶
type TestResult struct {
TestName string `json:"testName"`
ExitCode int `json:"exitCode"`
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
HttpResponses []HttpResponse `json:"httpResponses"`
}
type TestSetup ¶
type TestSetup struct {
CreateDirs []string `json:"createDirs"`
// Change this from map[string]string to []FileCreation
CreateFiles []FileCreation `json:"createFiles"`
DeleteFiles []string `json:"deleteFiles"`
DeleteDirs []string `json:"deleteDirs"`
}
TestSetup defines operations to perform before running a test