tektoncd / results

Long term storage of execution results.
Apache License 2.0
78 stars 74 forks source link

[CLI] Fix empty value for commandline flag #583

Closed khrm closed 1 year ago

khrm commented 1 year ago

tkn-result was receiving the empty value from the commandline. This fixes that by initializing after flags are set.

Fixes: #582

Changes

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you review them:

Release Notes

NONE
khrm commented 1 year ago

/assign @avinal

tekton-robot commented 1 year ago

@khrm: GitHub didn't allow me to assign the following users: avinal.

Note that only tektoncd members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. For more information please see the contributor guide

In response to [this](https://github.com/tektoncd/results/pull/583#issuecomment-1695315040): >/assign @avinal Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
khrm commented 1 year ago

@enarha @sayan-biswas Please review and merge this.

enarha commented 1 year ago

The change breaks the tests.

[ tmp] -> cd results/tools/tkn-results/
[ tkn-results] -> go test ./...
?       github.com/tektoncd/results/tools/tkn-results   [no test files]
?       github.com/tektoncd/results/tools/tkn-results/cmd/records       [no test files]
?       github.com/tektoncd/results/tools/tkn-results/docs      [no test files]
?       github.com/tektoncd/results/tools/tkn-results/internal/flags    [no test files]
?       github.com/tektoncd/results/tools/tkn-results/internal/format   [no test files]
?       github.com/tektoncd/results/tools/tkn-results/internal/portforward      [no test files]
ok      github.com/tektoncd/results/tools/tkn-results/cmd       0.013s
ok      github.com/tektoncd/results/tools/tkn-results/internal/client   0.034s
--- FAIL: TestParseFileConfig (0.00s)
    config_test.go:63:   (*config.Config)(
        -       nil,
        +       &{
        +               Address:        "a",
        +               Token:          "b",
        +               ServiceAccount: &config.ServiceAccount{Namespace: "e", Name: "f"},
        +               SSL:            config.SSLConfig{RootsFilePath: "c", ServerNameOverride: "d"},
        +       },
          )

--- FAIL: TestEnvVarConfig (0.00s)
    config_test.go:63:   (*config.Config)(
        -       nil,
        +       &{SSL: config.SSLConfig{RootsFilePath: "a", ServerNameOverride: "b"}},
          )

--- FAIL: TestFlagConfig (0.00s)
    config_test.go:63:   (*config.Config)(
        -       nil,
        +       &{
        +               Address:        "1",
        +               Token:          "2",
        +               ServiceAccount: &config.ServiceAccount{Namespace: "e", Name: "f"},
        +               SSL:            config.SSLConfig{RootsFilePath: "c", ServerNameOverride: "d"},
        +       },
          )

FAIL
FAIL    github.com/tektoncd/results/tools/tkn-results/internal/config   0.003s
FAIL
khrm commented 1 year ago

It seems previous tests were wrong. That's expected values.

khrm commented 1 year ago

OK. Fixed the tests.

khrm commented 1 year ago

@enarha @sayan-biswas Can you please review this and then merge?

sayan-biswas commented 1 year ago

/approve

tekton-robot commented 1 year ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: avinal, sayan-biswas

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/tektoncd/results/blob/main/OWNERS)~~ [sayan-biswas] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
enarha commented 1 year ago

/lgtm