Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Move to Native Testlets #80

Merged
merged 124 commits into from
Sep 26, 2016
Merged

Move to Native Testlets #80

merged 124 commits into from
Sep 26, 2016

Conversation

Mierdin
Copy link
Member

@Mierdin Mierdin commented Aug 23, 2016

This PR introduces native testlet capabilities - that is, the idea of providing functionality for the tests themselves, in native-go testlets, that are integrated at install time. A summary of changes are as follows

  • Testlet infrastructure, mainly for encouraging compatibility with the testlet standard. At first, the native testlet approach was going to have all testing functionality built in to the todd agent, but since then, the decision was made to keep them as separate binaries. However, some of the infrastructure here (such as the Testlet interface) was maintained to encourage compatibility.
  • Removal of the ping testlet, as that has been implemented here. The other bash testlets will be phased out in future PRs as their functionality is replaced by native Go testlets in the same way.
  • The testlets themselves are in separate repositories, and are only brought into the system when the install for ToDD proper is run. This is done via gettestlets.sh
  • Scripts to automate the download and installation of native testlet code. This is also helpful during development of testlets - though more work will be done in a future patch in this area.
  • Various documentation updates. It's important to note that many of these changes will be overwritten by a revamp to the documentation that is currently in a branch, and will be addressed after this PR.

This patch existed for a long time, and saw several changes in direction for this approach. Forgive the at-times chaotic nature of the changes below. Some of the changed files are only loosely with the main purpose of this patch.

This also satisfies https://github.com/Mierdin/todd/issues/87

Mierdin and others added 17 commits July 16, 2016 00:39
Signed-off-by: Matt Oswalt <[email protected]>
Signed-off-by: Matt Oswalt <[email protected]>
Signed-off-by: Matt Oswalt <[email protected]>
Signed-off-by: Matt Oswalt <[email protected]>
Signed-off-by: Matt Oswalt <[email protected]>
Signed-off-by: Matt Oswalt <[email protected]>
Signed-off-by: Matt Oswalt <[email protected]>
Signed-off-by: Matt Oswalt <[email protected]>
Signed-off-by: Matt Oswalt <[email protected]>
Signed-off-by: Matt Oswalt <[email protected]>
@Mierdin Mierdin mentioned this pull request Aug 23, 2016
@Mierdin Mierdin mentioned this pull request Sep 20, 2016
Signed-off-by: Matt Oswalt <[email protected]>
Signed-off-by: Matt Oswalt <[email protected]>
Signed-off-by: Matt Oswalt <[email protected]>
Signed-off-by: Matt Oswalt <[email protected]>
Signed-off-by: Matt Oswalt <[email protected]>
Signed-off-by: Matt Oswalt <[email protected]>
Signed-off-by: Matt Oswalt <[email protected]>
Signed-off-by: Matt Oswalt <[email protected]>
@Mierdin
Copy link
Member Author

Mierdin commented Sep 24, 2016

I believe I've addressed your comments.

log.Debugf("Full testlet command and args: '%s %s %s'", testlet_path, thisTarget, tr.Args)
cmd := exec.Command(testlet_path, thisTarget, tr.Args)
log.Debugf("Full testlet command and args: '%s %s %s'", testletPath, thisTarget, tr.Args)
cmd := exec.Command(testletPath, thisTarget, tr.Args)
Copy link
Member

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.

ctx, cancel := context.WithTimeout(context.Background(), time.Duration(ett.TimeLimit) * time.Second)
defer cancel()
cmd := exec.CommandContext(ctx, testletPath, thisTarget, tr.Args)

Copy link
Member Author

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


// 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 || os.IsNotExist(err) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.IsNotExist(err) will only be evaluated if err is nil, in which case os.IsNotExist will always return false.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, my intention was that regardless of the error, I wanted to treat it like the testlet didn't exist. However, that's fairly confusing.

I clarified this a bit by making the error more generic (and removing os.IsNotExist(err) in Mierdin@6f1db24 - stating in the error that there was simply a problem accessing the testlet

@Mierdin Mierdin merged commit d96dbe0 into master Sep 26, 2016
@Mierdin Mierdin deleted the native-testlets branch October 25, 2016 09:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants