-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: add health check e2e test * test: add latency check e2e test * test: add dns check e2e test * test: add file loader e2e test * fix: add missing version in openapi spec * chore: use go-yaml instead of yaml.v3 * chore: skip go files in bash e2e tests Signed-off-by: lvlcn-t <[email protected]>
- Loading branch information
Showing
30 changed files
with
783 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
"go.testFlags": [ | ||
"-race", | ||
"-cover", | ||
"-count=1" | ||
"-count=1", | ||
"-timeout=120s", | ||
] | ||
} |
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
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
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 |
---|---|---|
|
@@ -41,17 +41,21 @@ type ChecksController struct { | |
cResult chan checks.ResultDTO | ||
cErr chan error | ||
done chan struct{} | ||
// version is the version of the sparrow. | ||
// This is set at build time by using -ldflags "-X main.version=x.x.x". | ||
version string | ||
} | ||
|
||
// NewChecksController creates a new ChecksController. | ||
func NewChecksController(dbase db.DB, m metrics.Provider) *ChecksController { | ||
func NewChecksController(dbase db.DB, m metrics.Provider, version string) *ChecksController { | ||
return &ChecksController{ | ||
db: dbase, | ||
metrics: m, | ||
checks: runtime.Checks{}, | ||
cResult: make(chan checks.ResultDTO, 8), //nolint:mnd // Buffered channel to avoid blocking the checks | ||
cErr: make(chan error, 1), | ||
done: make(chan struct{}, 1), | ||
version: version, | ||
} | ||
} | ||
|
||
|
@@ -170,16 +174,20 @@ func (cc *ChecksController) UnregisterCheck(ctx context.Context, check checks.Ch | |
} | ||
|
||
var oapiBoilerplate = openapi3.T{ | ||
// this object should probably be user defined | ||
OpenAPI: "3.0.0", | ||
Info: &openapi3.Info{ | ||
Title: "Sparrow Metrics API", | ||
Version: "0.5.0", | ||
Description: "Serves metrics collected by sparrows checks", | ||
Contact: &openapi3.Contact{ | ||
URL: "https://caas.telekom.de", | ||
Email: "[email protected]", | ||
Name: "CaaS Team", | ||
}, | ||
License: &openapi3.License{ | ||
Name: "Apache 2.0", | ||
URL: "http://www.apache.org/licenses/LICENSE-2.0", | ||
}, | ||
}, | ||
Paths: &openapi3.Paths{ | ||
Extensions: make(map[string]any), | ||
|
@@ -196,6 +204,7 @@ var oapiBoilerplate = openapi3.T{ | |
func (cc *ChecksController) GenerateCheckSpecs(ctx context.Context) (openapi3.T, error) { | ||
log := logger.FromContext(ctx) | ||
doc := oapiBoilerplate | ||
doc.Info.Version = cc.version | ||
for _, c := range cc.checks.Iter() { | ||
name := c.Name() | ||
ref, err := c.Schema() | ||
|
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
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 @@ | ||
testdata/* |
Oops, something went wrong.