Skip to content

Commit

Permalink
Fixing compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ycombinator committed Aug 21, 2020
1 parent c4fa125 commit e60b3b5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/testrunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func testTypeCommandActionFactory(testType testrunner.TestType) cobraext.Command
return errors.Wrap(err, "unable to determine test folder paths")
}

if failOnMissing && len(testFolderPaths) == 0 {
if failOnMissing && len(testFolders) == 0 {
if dataset != "" {
return fmt.Errorf("no %s tests found for %s dataset(s)", testType, dataset)
}
Expand Down
6 changes: 3 additions & 3 deletions internal/kibana/ingestmanager/policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (c *Client) post(resourcePath string, reqBody io.Reader) (int, []byte, erro
url := path.Join(c.apiBaseUrl, resourcePath)
req, err := http.NewRequest(http.MethodPost, url, reqBody)
if err != nil {
return 0, "", errors.Wrapf(err, "could not create POST request to Ingest Manager resource: %s", resourcePath)
return 0, nil, errors.Wrapf(err, "could not create POST request to Ingest Manager resource: %s", resourcePath)
}

req.SetBasicAuth(c.username, c.password)
Expand All @@ -70,13 +70,13 @@ func sendRequest(req *http.Request) (*http.Response, int, []byte, error) {
client := http.Client{}
resp, err := client.Do(req)
if err != nil {
return nil, 0, "", errors.Wrap(err, "could not send request to Kibana API")
return nil, 0, nil, errors.Wrap(err, "could not send request to Kibana API")
}

defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return resp, resp.StatusCode, "", errors.Wrap(err, "could not read response body")
return resp, resp.StatusCode, nil, errors.Wrap(err, "could not read response body")
}

return resp, resp.StatusCode, body, nil
Expand Down
6 changes: 4 additions & 2 deletions internal/testrunner/runners/system/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,18 @@ func (r *runner) run() error {
return errors.Wrap(err, "could not create ingest manager client")
}

policy := ingestmanager.Policy{
p := ingestmanager.Policy{
Name: fmt.Sprintf("ep-test-system-%s-%s", r.testFolder.Package, r.testFolder.Dataset),
Description: fmt.Sprintf("test policy created by elastic-package test system for data stream %s/%s", r.testFolder.Package, r.testFolder.Dataset),
Namespace: "ep",
}
policy, err = im.CreatePolicy(policy)
policy, err := im.CreatePolicy(p)
if err != nil {
return errors.Wrap(err, "could not create policy")
}

fmt.Println(policy)

// Step 4. (TODO in future) Optionally exercise service to generate load.

// Step 5. Assert that there's expected data in data stream.
Expand Down
2 changes: 1 addition & 1 deletion internal/testrunner/testrunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func FindTestFolders(packageRootPath string, testType TestType, datasets []strin
return nil, errors.Wrap(err, "error finding test folders")
}

folders := make([]TestFolder, len(matches))
folders := make([]TestFolder, len(paths))
for _, p := range paths {
parts := filepath.SplitList(p)
pkg := parts[0]
Expand Down

0 comments on commit e60b3b5

Please sign in to comment.