CCI-MOC / hil

Hardware Isolation Layer, formerly Hardware as a Service
Apache License 2.0
24 stars 54 forks source link

Enforce unique contraints on object names/labels in the database. #971

Closed xuhang57 closed 6 years ago

xuhang57 commented 6 years ago

Fix: #946

Potentially, we should think about whether there are any other constraints.

And this might break lots of tests. Consider this is an on-going implementation

xuhang57 commented 6 years ago

Some help would be much appreciated.

I am suspecting that because this is called many time:

https://github.com/CCI-MOC/hil/blob/45f218d272a4da8cd21694bcf1de0783a165b756/tests/unit/api/auth.py#L612

so the node name is not unique in the CI database?

coveralls commented 6 years ago

Pull Request Test Coverage Report for Build 1693


Totals Coverage Status
Change from base Build 1686: 0.0%
Covered Lines: 2097
Relevant Lines: 3534

💛 - Coveralls
coveralls commented 6 years ago

Pull Request Test Coverage Report for Build 1729


Changes Missing Coverage Covered Lines Changed/Added Lines %
hil/migrations/versions/264ddaebdfcc_make_labels_unique.py 6 14 42.86%
<!-- Total: 11 19 57.89% -->
Totals Coverage Status
Change from base Build 1686: -0.07%
Covered Lines: 2103
Relevant Lines: 3548

💛 - Coveralls
zenhack commented 6 years ago

Could you also write a migration script? Other than that, LGTM.

naved001 commented 6 years ago

project names, switch names, network names are unique too.

naved001 commented 6 years ago

Honestly, I'm not sure it's worth the effort to properly support database downgrades, and we've only been adding the function at all because alembic expects it.

I agree.

zenhack commented 6 years ago

I'm happy. If everyone's in agreement re: coveralls we can just merge.

naved001 commented 6 years ago

Cool, merging then.