-
Notifications
You must be signed in to change notification settings - Fork 852
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Smoketests to nightly runs (#16226)
* Adding Smoketests to nightly runs * updating location, fixes to script * starting go script * finishing script * updating yml file * formatting * adding snippet for finding go code * adding funcitonality for copying examples * trimming out unused funcs * fixed regexp, thanks benbp * fixing smoke test program to create go.mod file correctly, update powershell for nightly * removing need for argument in go program, updating yml and powershell to reflect * scripts not common * smoketests, plural not singular * finally got the right directory * fixed script locally, running into permissions issue on ci * updating script to exit properly, logging an error instead of panicing * manually set go111module to on * removing references to go111module * issue with duplicated function names... * updating to only pull examples from the service directory if one is provided * runs samples now too! * adding 'go run .' step to ps1, triggering for tables * adding step to analyze.yml file * adding debugging for ci * updating to work in ci * updating to specify go module name, removing print statements * updating scripts to fmt for prettier printing, find all environment variables * working on loading environment variables from file * removing env vars from example_test.go for testing * adding the environment variable portion to the generated main.go file * forgot to remove change to nightly script * adding import to the main file * cleaning up code, adding comments * don't import os if no env vars * small changes for checking all packages * removing _test suffix on copied files * converting to use cobra for better support * formatting
- Loading branch information
1 parent
d25e96a
commit c513fbb
Showing
10 changed files
with
1,378 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#Requires -Version 7.0 | ||
|
||
Param( | ||
[string] $serviceDirectory | ||
) | ||
|
||
$repoRoot = Resolve-Path "$PSScriptRoot/../../" | ||
|
||
Push-Location $repoRoot/eng/tools/smoketests | ||
|
||
# create a smoketests directory | ||
$smoketestsDir = Join-Path $repoRoot sdk smoketests | ||
Write-Host "Creating a new directory for smoketests at $smoketestsDir" | ||
New-Item -Path $smoketestsDir -ItemType Directory | ||
|
||
Push-Location $smoketestsDir | ||
Write-Host "Running 'go mod init' in $pwd" | ||
go mod init github.com/Azure/azure-sdk-for-go/sdk/smoketests | ||
Pop-Location | ||
|
||
# Run smoketests script | ||
Write-Host "Running 'go run . -serviceDirectory $serviceDirectory'" | ||
go run . -serviceDirectory $serviceDirectory | ||
if ($LASTEXITCODE) { | ||
exit $LASTEXITCODE | ||
} | ||
|
||
Pop-Location | ||
|
||
# Run go mod tidy and go build. If these succeed the smoke tests pass | ||
Push-Location $smoketestsDir | ||
go fmt ./... | ||
Write-Host "Printing content of go.mod file:" | ||
Get-Content go.mod | ||
Write-Host "Printing content of main.go file" | ||
Get-Content main.go | ||
go mod tidy | ||
go build ./... | ||
go run . | ||
|
||
Pop-Location | ||
|
||
# Clean-up the directory created | ||
Remove-Item -Path $smoketestsDir -Recurse -Force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#Requires -Version 7.0 | ||
|
||
Param( | ||
[string] $serviceDirectory | ||
) | ||
|
||
Write-Host $PSScriptRoot | ||
|
||
# 1. Every module uses a replace directive to the local version | ||
# 2. Include every module (data & mgmt) in a go.mod file | ||
# 3. Run `go mod tidy` and ensure it succeeds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package cmd | ||
|
||
import "fmt" | ||
|
||
type ConfigFile struct { | ||
Packages []Package | ||
} | ||
|
||
type Package struct { | ||
Name string | ||
CoverageGoal float64 | ||
EnvironmentVariables map[string]string | ||
} | ||
|
||
type Module struct { | ||
Name string | ||
Version string | ||
Replace string | ||
} | ||
|
||
type SemVer struct { | ||
Major, Minor, Patch int | ||
} | ||
|
||
func (s SemVer) Newer(s2 SemVer) bool { | ||
if s.Major > s2.Major { | ||
return true | ||
} else if s.Major == s2.Major && s.Minor > s2.Minor { | ||
return true | ||
} else if s.Major == s2.Major && s.Minor == s2.Minor && s.Patch > s2.Patch { | ||
return true | ||
} | ||
return false | ||
} | ||
|
||
func (s SemVer) String() string { | ||
return fmt.Sprintf("v%d.%d.%d", s.Major, s.Minor, s.Patch) | ||
} |
Oops, something went wrong.