Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

Conversation

@ocket8888
Copy link
Contributor

@ocket8888 ocket8888 commented Oct 15, 2019

What does this PR (Pull Request) do?

This rewrites the previously unimplemented PUT handler of /user/current into Go. It adds support in both the Go and Python clients, with some associated testing as well as documentation updates.

This differs from the way the endpoint was handled in Perl - in Perl, every field in the request was optional (under the top-level "user" object, obviously) and only those included would be updated - as though it were a PATCH request. This instead demands a full representation of a user as is proper for PUT. Additionally, the Perl returned only a success message, this handler returns a representation of the user as it exists following the update.

Pursuant to a mailing list discussion changing this endpoint's behavior - albeit for the better - was shot down, and I re-rewrote it to implement Perl-style PATCH-like behavior.

Which Traffic Control components are affected by this PR?

  • Documentation
  • Traffic Control Client (Python)
  • Traffic Control Client (Go)
  • Traffic Ops

What is the best way to verify this PR?

Build a TO RPM, start Traffic Ops, make a PUT request to /user/current, run the Go client/API integration tests, build and read the documentation.

The following criteria are ALL met by this PR

  • This PR includes tests
  • This PR includes documentation
  • This PR includes an update to CHANGELOG.md
  • This PR includes any and all required license headers
  • This PR does not include a database migration
  • This PR DOES NOT FIX A SERIOUS SECURITY VULNERABILITY

@ocket8888 ocket8888 added Traffic Ops related to Traffic Ops documentation related to documentation tests related to tests and/or testing infrastructure TC Client (python) related to the Python implementation of a TC client TO Client (Go) related to the Go implementation of a TC client labels Oct 15, 2019
@ocket8888 ocket8888 added this to the Go Rewrite milestone Oct 15, 2019
@asf-ci
Copy link
Contributor

asf-ci commented Oct 15, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4533/

@ocket8888
Copy link
Contributor Author

retest this please

@asf-ci
Copy link
Contributor

asf-ci commented Oct 18, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4578/

Copy link
Contributor

Choose a reason for hiding this comment

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

think about using sqlx structscan? and sqlx for the query above instead of using $1,$2,$3,$4. With a big parametrized query like this I worry about maintenance/debugging

@asf-ci
Copy link
Contributor

asf-ci commented Oct 21, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4599/

@mitchell852 mitchell852 added the tech debt rework due to choosing easy/limited solution label Oct 24, 2019
@asf-ci
Copy link
Contributor

asf-ci commented Oct 29, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4670/

@asf-ci
Copy link
Contributor

asf-ci commented Oct 31, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4681/

Copy link
Contributor

@mhoppa mhoppa left a comment

Choose a reason for hiding this comment

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

Manually testing looks great.

One thing I did notice is the perl implementation requires certain fields to be defined. Do we want to carry that requirement through?

{
    "alerts": [
        {
            "level": "error",
            "text": "fullName is required"
        },
        {
            "level": "error",
            "text": "email is required"
        },
        {
            "level": "error",
            "text": "role is required"
        },
        {
            "level": "error",
            "text": "username is required"
        }
    ]
}

Copy link
Contributor

@mhoppa mhoppa left a comment

Choose a reason for hiding this comment

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

manual tests work and so do API tests

@asf-ci
Copy link
Contributor

asf-ci commented Nov 1, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4689/

@ocket8888
Copy link
Contributor Author

Eh. I don't think that difference is actually going to break anyone, and I did make sure identifiers can't be null. And to be honest I'm sick to death of working on this.

@asf-ci
Copy link
Contributor

asf-ci commented Nov 1, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4694/

@asf-ci
Copy link
Contributor

asf-ci commented Nov 4, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4704/

@asf-ci
Copy link
Contributor

asf-ci commented Nov 4, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4705/

@asf-ci
Copy link
Contributor

asf-ci commented Nov 7, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4726/

@asf-ci
Copy link
Contributor

asf-ci commented Nov 11, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4767/

@mhoppa
Copy link
Contributor

mhoppa commented Nov 20, 2019

can you rebase?

@asf-ci
Copy link
Contributor

asf-ci commented Dec 16, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4943/

@asf-ci
Copy link
Contributor

asf-ci commented Dec 16, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4944/

@asf-ci
Copy link
Contributor

asf-ci commented Dec 17, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4948/

@asf-ci
Copy link
Contributor

asf-ci commented Dec 17, 2019

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/4949/

Copy link
Member

@mitchell852 mitchell852 left a comment

Choose a reason for hiding this comment

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

unit tests, api tests, ui tests and manual TP test passed.

@mitchell852 mitchell852 merged commit 052f5e9 into apache:master Dec 19, 2019
@ocket8888 ocket8888 deleted the user-current-go branch December 19, 2019 21:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

documentation related to documentation TC Client (python) related to the Python implementation of a TC client tech debt rework due to choosing easy/limited solution tests related to tests and/or testing infrastructure TO Client (Go) related to the Go implementation of a TC client Traffic Ops related to Traffic Ops

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rewrite /user/current to Go

7 participants