This repository has been archived by the owner on Oct 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Move to Native Testlets #80
Merged
Merged
Changes from all commits
Commits
Show all changes
124 commits
Select commit
Hold shift + click to select a range
89cc89f
updated testlet doc
Mierdin 573f2b4
Added testlet interface
Mierdin 0a9d723
Simplified error returns for client (#45)
Mierdin 2e1cbc3
Merge branch 'master' of github.com:Mierdin/todd
Mierdin ebf0001
Saving progress on building native testlet infrastructure
Mierdin 5742306
Docs update
Mierdin 726bc83
Made progress on a native testlet implementation
Mierdin 2f389b6
Implement async handling of testlet running
Mierdin 91ce8ed
Further progress
Mierdin f023d31
Catch-up commit
Mierdin 8b6d304
Updating docs
Mierdin 412423a
Updates to vagrant and make
Mierdin 7909ab4
Catch up
Mierdin aec7dd2
Got native testlets working
Mierdin c09854c
Catch up
Mierdin 0e652b6
Added note about future development efforts around testlets
Mierdin 7b0f02d
Some fixes from reviewing the PR
Mierdin 6875683
Update IP field in DB and TSDB config section to Host (#78)
vcabbage 9a42484
Add comment for 'make start' and increase sleep timers for container …
Mierdin 3e10090
Moved testlets outside to the testing package
Mierdin f4041cc
Updated testlets.go
Mierdin 69e7caf
Merge branch 'native-testlets' of github.com:Mierdin/todd into native…
Mierdin 588b237
Various moves
Mierdin eec275f
removed all old work from testlets (moved to archive)
Mierdin f4734f1
Reorganized testing logic
Mierdin 7cae0cf
updated comment regarding future development script
Mierdin 880e07b
removed sudo from sysctl command in makefile
Mierdin 8c4b981
Updates to makefile and vagrantfile
Mierdin 5f1c30b
Added script to add socket capabilities to testlet binaries on install
Mierdin 14d9929
Made capabilities script exec
Mierdin 7408315
Added some comments about install process
Mierdin 4045257
Saving progress on building native testlet infrastructure
Mierdin 967ed0d
Docs update
Mierdin b2acddd
Made progress on a native testlet implementation
Mierdin 5a3401f
Implement async handling of testlet running
Mierdin 7ee3fd6
Further progress
Mierdin 62ba6c0
Catch-up commit
Mierdin 7ac7dca
Updating docs
Mierdin 02bd94e
Updates to vagrant and make
Mierdin 0a229bd
Catch up
Mierdin 4929bec
Got native testlets working
Mierdin 19f2de9
Catch up
Mierdin 99c2533
Added note about future development efforts around testlets
Mierdin 4c0d0ce
Some fixes from reviewing the PR
Mierdin 5056f30
Moved testlets outside to the testing package
Mierdin 7adfee1
Updated testlets.go
Mierdin 287aa03
Various moves
Mierdin 7c67377
removed all old work from testlets (moved to archive)
Mierdin 3d96d8a
Reorganized testing logic
Mierdin 6cb591c
updated comment regarding future development script
Mierdin 9d8e7ae
removed sudo from sysctl command in makefile
Mierdin 1c83aea
Updates to makefile and vagrantfile
Mierdin bd0f9f7
Added script to add socket capabilities to testlet binaries on install
Mierdin ca56642
Made capabilities script exec
Mierdin 89081e8
Added some comments about install process
Mierdin 823d0cc
Merge branch 'native-testlets' of github.com:Mierdin/todd into native…
Mierdin 2f2f2a3
Removed extra crap from rebase
Mierdin 7235411
Moved capabilities script to 'compile'
Mierdin 5e2dc41
Removed old sysctl command from Makefile
Mierdin 83de4a0
Added comment about folder redir to Vagrantfile
Mierdin 8e79ee7
Moved capabilities back to 'install', where it's likely to get sudo (…
Mierdin 954fe27
Converted to unbuffered channel, and removed comment about server tes…
Mierdin 9be0b0a
Added URL to issue for scheduled testruns
Mierdin 5aa3288
Removed unnecessary comment block
Mierdin 467b552
Removed duplicate code that checks for native testlets and retrieves …
Mierdin 30a312d
Updated docstring for GetTestletPath
Mierdin 06fb854
Removed roadmap (will be re-added in upcoming docs revamp
Mierdin 1115f6d
Removed old DSL files
Mierdin a6e5a7d
Used correct loglevel in GetTestletPath
Mierdin 1b91cf9
Add error handling to influxdb TSDB plugin (#79)
vcabbage 79d91f6
Saving progress on building native testlet infrastructure
Mierdin 9ce5844
Docs update
Mierdin 6b6fe19
Made progress on a native testlet implementation
Mierdin e9f72e8
Implement async handling of testlet running
Mierdin 1e6fdf4
Further progress
Mierdin e1eda3a
Catch-up commit
Mierdin 9b50b20
Updating docs
Mierdin 1e5f023
Updates to vagrant and make
Mierdin 9e0bddf
Catch up
Mierdin 5c44e3e
Got native testlets working
Mierdin 43f3309
Catch up
Mierdin ca3352b
Added note about future development efforts around testlets
Mierdin 89ea72a
Some fixes from reviewing the PR
Mierdin 25b64d5
Moved testlets outside to the testing package
Mierdin e632a04
Updated testlets.go
Mierdin fdf2571
Various moves
Mierdin 84ea3b7
Reorganized testing logic
Mierdin b5aeda3
updated comment regarding future development script
Mierdin 37fc165
removed sudo from sysctl command in makefile
Mierdin e53e916
Updates to makefile and vagrantfile
Mierdin 8ddffcf
Added script to add socket capabilities to testlet binaries on install
Mierdin 376693e
Made capabilities script exec
Mierdin ecf6784
Added some comments about install process
Mierdin 213cc97
Saving progress on building native testlet infrastructure
Mierdin 0b85873
Docs update
Mierdin c781b56
Made progress on a native testlet implementation
Mierdin 60925b1
Implement async handling of testlet running
Mierdin a6b5136
Further progress
Mierdin 94fdc30
Catch-up commit
Mierdin e837048
Updates to vagrant and make
Mierdin 93aef66
Catch up
Mierdin 15536a6
Got native testlets working
Mierdin eb8a3c3
Catch up
Mierdin 2c87bf3
Moved testlets outside to the testing package
Mierdin ba132d8
Updated testlets.go
Mierdin 4e6a2ff
Various moves
Mierdin ecab915
removed all old work from testlets (moved to archive)
Mierdin 5db5c0d
Reorganized testing logic
Mierdin 318a560
removed sudo from sysctl command in makefile
Mierdin 66f43cf
Made capabilities script exec
Mierdin a91ccfa
Added some comments about install process
Mierdin 9a5a09b
Removed extra crap from rebase
Mierdin a04a6c9
Moved capabilities script to 'compile'
Mierdin 4163110
Removed old sysctl command from Makefile
Mierdin cf5da33
Added comment about folder redir to Vagrantfile
Mierdin 5a97598
Removed unnecessary comment block
Mierdin 118c9b5
Removed duplicate code that checks for native testlets and retrieves …
Mierdin 579b7b2
Updated docstring for GetTestletPath
Mierdin 4b63c09
Removed roadmap (will be re-added in upcoming docs revamp
Mierdin 6776423
Removed old DSL files
Mierdin 4905176
Used correct loglevel in GetTestletPath
Mierdin 1fa262b
Merge branch 'native-testlets' of github.com:Mierdin/todd into native…
Mierdin 0b13b92
Incorporated changes suggested in review
Mierdin 6f1db24
Made error handling for testlet not existing more generic
Mierdin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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,67 @@ | ||
/* | ||
ToDD testing package | ||
|
||
Contains infrastructure running testlets as well as maintaining | ||
conformance for other native-Go testlet projects | ||
|
||
Copyright 2016 Matt Oswalt. Use or modification of this | ||
source code is governed by the license provided here: | ||
https://github.com/Mierdin/todd/blob/master/LICENSE | ||
*/ | ||
|
||
package testing | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"os" | ||
|
||
log "github.com/Sirupsen/logrus" | ||
) | ||
|
||
var ( | ||
|
||
// This map provides name redirection so that the native testlets can use names that don't | ||
// conflict with existing system tools (i.e. using "toddping" instead of "ping") but users | ||
// can still refer to the testlets using simple names. | ||
// | ||
// In short, users refer to the testlet by <key> and this map will redirect to the | ||
// actual binary name <value> | ||
nativeTestlets = map[string]string{ | ||
"ping": "toddping", | ||
} | ||
) | ||
|
||
// Testlet defines what a testlet should look like if built in native | ||
// go and compiled with the agent | ||
type Testlet interface { | ||
|
||
// Run is the "workflow" function for a testlet. All testing takes place here | ||
// (or in a function called within) | ||
Run(target string, args []string, timeLimit int) (metrics map[string]string, err error) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having a "Base*" struct seems like an attempt to use inheritance. What does this add beyond the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nothing, now. This was another relic from the previous approach. Removed in upcoming patch |
||
|
||
// GetTestletPath generates whatever path is needed to reach the given testlet | ||
// It first determines if the referenced testlet is native or not - if it is native, | ||
// then only the name needs to be returned (all native testlets must be in the path). | ||
// If it is a custom testlet, then it will generate the full path to the testlet, | ||
// ensure it is a valid path, and if so, return that full path back to the caller. | ||
func GetTestletPath(testletName, optDir string) (string, error) { | ||
|
||
if _, ok := nativeTestlets[testletName]; ok { | ||
log.Debugf("%s is a native testlet", testletName) | ||
return nativeTestlets[testletName], nil | ||
} | ||
|
||
log.Debugf("%s is a custom testlet", testletName) | ||
|
||
// Generate path to testlet and make sure it exists. | ||
testletPath := fmt.Sprintf("%s/assets/testlets/%s", optDir, testletName) | ||
if _, err := os.Stat(testletPath); err != nil { | ||
log.Errorf("Problem accessing testlet %q on this agent", testletName) | ||
return "", errors.New("Error installing testrun - problem accessing testrun on agent") | ||
} | ||
|
||
return testletPath, nil | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General note, this could be changed to use
exec.CommandContext
(added in 1.7) and simplify the timeout logic below.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created https://github.com/Mierdin/todd/issues/93 to track this so that when I move CI to Go 1.7, I'll add this. Thanks