#### What does this PR do?

This PR updates parsing uniqueness errors,
adds parsing for fk constraint errors,
adds parsing for not null constraint errors

When verifying this PR, I recommend running the same tests on master.

#### Which TC components are affected by this PR?

- [ ] Documentation
- [ ] Grove
- [ ] Traffic Analytics
- [ ] Traffic Monitor
- [x] Traffic Ops
- [ ] Traffic Ops ORT
- [ ] Traffic Portal
- [ ] Traffic Router
- [ ] Traffic Stats
- [ ] Traffic Vault
- [ ] Other _________

#### What is the best way to verify this PR?

Testing not null constraint:

`curl -XPOST -Lvsk --cookie $mc 'https://localhost:6443/api/1.3/cdns' -d 
@cdn.json | jq`
```@cdn.json
{
    "name": "cdn-test",
    "domainName": "new-name"
}
```

```json
{
    "alerts": [
        {
            "text": "dnssecEnabled is a required field",
            "level": "error"
        }
    ]
}
```

-----

Testing uniqueness constraint error:

```@cdn.json
{
    "name": "cdn-test",
    "domainName": "new-name",
    "dnssecEnabled": false
}
```

Post the above twice, you should get the following:

```json
{
    "alerts": [
        {
            "text": "name cdn-test already exists.",
            "level": "error"
        }
    ]
}
```

-----

Testing foreign keys:

`curl -XPOST -Lvsk --cookie $mc 'https://localhost:6443/api/1.3/origins' -d 
@origin.json | jq`
```json
{
    "cachegroupId": 1,
    "coordinateId": 1,
    "deliveryServiceId": 1,
    "fqdn": "foo.example.com",
    "id": 1,
    "ip6Address": "cafe:dead:d0d0::42",
    "ipAddress": "10.2.3.4",
    "name": "origin1",
    "port": 443,
    "profileId": 1,
    "protocol": "https",
    "tenantId": 1
}
```

```json
{
    "alerts": [
        {
            "text": "deliveryservice not found",
            "level": "error"
        }
    ]
}
```

#### Check all that apply

- [ ] This PR includes tests
- [ ] This PR includes documentation updates
- [ ] This PR includes an update to CHANGELOG.md
- [ ] This PR includes all required license headers
- [ ] This PR includes a database migration (ensure that migration sequence is 
correct)
- [ ] This PR fixes a serious security flaw. Read more: 
[www.apache.org/security](http://www.apache.org/security/)

<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
-->





[ Full content available at: https://github.com/apache/trafficcontrol/pull/2849 
]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to