-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Aman Parauliya <[email protected]>
- Loading branch information
Aman Parauliya
committed
Sep 12, 2023
1 parent
afccd30
commit b349121
Showing
12 changed files
with
147 additions
and
135 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
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
apiVersion: executor.testkube.io/v1 | ||
kind: Executor | ||
metadata: | ||
name: jmeter-executor | ||
name: jmeterd-executor | ||
namespace: testkube | ||
spec: | ||
features: | ||
- artifacts | ||
image: kubeshop/testkube-jmeter-executor:dev-008 | ||
image: kubeshop/testkube-jmeterd-executor:dev-008 | ||
types: | ||
- jmeter/test | ||
- jmeterd/test |
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,82 @@ | ||
package runner | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/kubeshop/testkube/contrib/executor/jmeter/pkg/parser" | ||
"github.com/kubeshop/testkube/pkg/api/v1/testkube" | ||
) | ||
|
||
func mapResultsToExecutionResults(out []byte, results parser.Results) (result testkube.ExecutionResult) { | ||
result.Status = testkube.ExecutionStatusPassed | ||
if results.HasError { | ||
result.Status = testkube.ExecutionStatusFailed | ||
result.ErrorMessage = results.LastErrorMessage | ||
} | ||
|
||
result.Output = string(out) | ||
result.OutputType = "text/plain" | ||
|
||
for _, r := range results.Results { | ||
result.Steps = append( | ||
result.Steps, | ||
testkube.ExecutionStepResult{ | ||
Name: r.Label, | ||
Duration: r.Duration.String(), | ||
Status: mapResultStatus(r), | ||
AssertionResults: []testkube.AssertionResult{{ | ||
Name: r.Label, | ||
Status: mapResultStatus(r), | ||
}}, | ||
}) | ||
} | ||
|
||
return result | ||
} | ||
|
||
func mapTestResultsToExecutionResults(out []byte, results parser.TestResults) (result testkube.ExecutionResult) { | ||
result.Status = testkube.ExecutionStatusPassed | ||
|
||
result.Output = string(out) | ||
result.OutputType = "text/plain" | ||
|
||
samples := append(results.HTTPSamples, results.Samples...) | ||
for _, r := range samples { | ||
if !r.Success { | ||
result.Status = testkube.ExecutionStatusFailed | ||
if r.AssertionResult != nil { | ||
result.ErrorMessage = r.AssertionResult.FailureMessage | ||
} | ||
} | ||
|
||
result.Steps = append( | ||
result.Steps, | ||
testkube.ExecutionStepResult{ | ||
Name: r.Label, | ||
Duration: fmt.Sprintf("%dms", r.Time), | ||
Status: mapTestResultStatus(r.Success), | ||
AssertionResults: []testkube.AssertionResult{{ | ||
Name: r.Label, | ||
Status: mapTestResultStatus(r.Success), | ||
}}, | ||
}) | ||
} | ||
|
||
return result | ||
} | ||
|
||
func mapResultStatus(result parser.Result) string { | ||
if result.Success { | ||
return string(testkube.PASSED_ExecutionStatus) | ||
} | ||
|
||
return string(testkube.FAILED_ExecutionStatus) | ||
} | ||
|
||
func mapTestResultStatus(success bool) string { | ||
if success { | ||
return string(testkube.PASSED_ExecutionStatus) | ||
} | ||
|
||
return string(testkube.FAILED_ExecutionStatus) | ||
} |
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
Oops, something went wrong.