Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Smoketests to nightly runs #16226

Merged
merged 40 commits into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6d098bb
Adding Smoketests to nightly runs
seankane-msft Nov 19, 2021
03d0289
updating location, fixes to script
seankane-msft Nov 19, 2021
31dfeff
starting go script
seankane-msft Nov 19, 2021
1e3036e
finishing script
seankane-msft Nov 22, 2021
ae14ef8
updating yml file
seankane-msft Nov 22, 2021
9f1893d
formatting
seankane-msft Nov 22, 2021
4bc2e7d
adding snippet for finding go code
seankane-msft Nov 22, 2021
2afb20e
adding funcitonality for copying examples
seankane-msft Nov 29, 2021
29887e1
trimming out unused funcs
seankane-msft Nov 29, 2021
ffaefb0
fixed regexp, thanks benbp
seankane-msft Nov 29, 2021
0ea680d
fixing smoke test program to create go.mod file correctly, update pow…
seankane-msft Nov 30, 2021
d8b0a3a
removing need for argument in go program, updating yml and powershell…
seankane-msft Nov 30, 2021
ae5a7e3
scripts not common
seankane-msft Nov 30, 2021
3d96590
smoketests, plural not singular
seankane-msft Nov 30, 2021
e9a6466
finally got the right directory
seankane-msft Nov 30, 2021
4b3d81e
fixed script locally, running into permissions issue on ci
seankane-msft Nov 30, 2021
470fd4d
updating script to exit properly, logging an error instead of panicing
seankane-msft Nov 30, 2021
4a9a1aa
manually set go111module to on
seankane-msft Nov 30, 2021
55aa836
removing references to go111module
seankane-msft Nov 30, 2021
1bf218a
issue with duplicated function names...
seankane-msft Dec 2, 2021
1da7e53
updating to only pull examples from the service directory if one is p…
seankane-msft Dec 2, 2021
fa5d38d
runs samples now too!
seankane-msft Dec 2, 2021
c5e2694
merge conflict
seankane-msft Dec 3, 2021
361d57e
adding 'go run .' step to ps1, triggering for tables
seankane-msft Dec 3, 2021
3603181
adding step to analyze.yml file
seankane-msft Dec 3, 2021
81a3a54
adding debugging for ci
seankane-msft Dec 3, 2021
801e778
updating to work in ci
seankane-msft Dec 3, 2021
54130be
updating to specify go module name, removing print statements
seankane-msft Dec 3, 2021
47c47fe
updating scripts to fmt for prettier printing, find all environment v…
seankane-msft Dec 3, 2021
298aa5c
working on loading environment variables from file
seankane-msft Dec 16, 2021
60be064
removing env vars from example_test.go for testing
seankane-msft Dec 16, 2021
ad05025
adding the environment variable portion to the generated main.go file
seankane-msft Dec 16, 2021
89b4d34
forgot to remove change to nightly script
seankane-msft Dec 16, 2021
3793ba6
adding import to the main file
seankane-msft Dec 16, 2021
93a1bfb
cleaning up code, adding comments
seankane-msft Dec 16, 2021
4c77d8c
don't import os if no env vars
seankane-msft Dec 16, 2021
1925e2a
small changes for checking all packages
seankane-msft Dec 16, 2021
59f88ef
removing _test suffix on copied files
seankane-msft Dec 16, 2021
61fff90
converting to use cobra for better support
seankane-msft Dec 20, 2021
cb9d911
formatting
seankane-msft Dec 20, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion eng/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@
},
{
"Name": "data",
"CoverageGoal": 0.62
"CoverageGoal": 0.62,
"EnvironmentVariables": {
"TABLES_STORAGE_ACCOUNT_NAME": "fakeaccount",
"TABLES_PRIMARY_STORAGE_ACCOUNT_KEY": "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==",
"TABLES_SHARED_ACCESS_SIGNATURE": "?sig=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
}
},
{
"Name": "eng/tools",
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/templates/jobs/archetype-go-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ stages:
displayName: 'Release: ${{ parameters.ServiceDirectory }}'
dependsOn: CheckRelease
condition: and(succeeded(), eq(dependencies.CheckRelease.outputs['CheckReleaseJob.Verify.NeedToRelease'], 'true'))
jobs:
jobs:
- deployment: TagRepository
displayName: "Create release tag"
condition: and(succeeded(), eq(variables['NeedToRelease'], 'true'), ne(variables['Skip.TagRepository'], 'true'))
Expand Down
8 changes: 8 additions & 0 deletions eng/pipelines/templates/steps/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,11 @@ steps:
parameters:
PackageName: 'sdk/${{parameters.ServiceDirectory}}'
ForRelease: false

- task: PowerShell@2
displayName: 'Run Nightly SmokeTests'
inputs:
targetType: 'filePath'
filePath: ./eng/scripts/Smoke_Tests_Nightly.ps1
pwsh: true
arguments: '${{ parameters.ServiceDirectory }}'
44 changes: 44 additions & 0 deletions eng/scripts/Smoke_Tests_Nightly.ps1
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
11 changes: 11 additions & 0 deletions eng/scripts/Smoke_Tests_Release.ps1
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
38 changes: 38 additions & 0 deletions eng/tools/smoketests/cmd/models.go
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)
}
Loading