feat: Added New schema for CCCO(HPCC) for contract validation#213
Conversation
|
|
||
| func TestVerifyContractWithSchemaValidConfidentialContainers(t *testing.T) { | ||
| // Contract with ALL required fields for confidential-containers | ||
| contract := `workload: | |
There was a problem hiding this comment.
keep sample contract in samples folder
samples -> hpcc
There was a problem hiding this comment.
@vikas-sharma24 Thanks for the review , So you can see there are multiple test case for validation of both-ve and +ve cases if i move each contract file under samples , there will be more files under that So i have created string type of contract for validation at runtime .
Thanks.
There was a problem hiding this comment.
@Sashwat-K any suggestion here
I feel keeping contract sample in samples -> hpcc folder make more sense then keeping contract sample in testcases
Can you suggest what can we do here?
There was a problem hiding this comment.
I would agree with @vikas-sharma24 . If you check the existing repo, we have created files instead of defining it in const
| assert.Error(t, err) | ||
| } | ||
|
|
||
| func TestVerifyContractWithSchemaValidConfidentialContainers(t *testing.T) { |
There was a problem hiding this comment.
add testcase description
| // This SHOULD pass because all required fields are present | ||
| err := VerifyContractWithSchema(contract, "hpcc-peerpod") | ||
|
|
||
| // Assert that validation passes |
There was a problem hiding this comment.
I dont think this is needed as it will add extra log statements in console when we run testcases
@Sashwat-K any suggestion here
| // NEGATIVE TEST 1: Testcase to verify validation fails when regoValidator is missing | ||
| func TestVerifyContractWithSchemaMissingRegoValidator(t *testing.T) { | ||
| // Contract with confidential-containers but missing regoValidator | ||
| contract := `workload: | |
There was a problem hiding this comment.
same keep sample in samples -> hpcc folder
| } | ||
|
|
||
| // NEGATIVE TEST 2: Testcase to verify validation fails when only config is provided | ||
| func TestVerifyContractWithSchemaMinimalConfidentialContainers(t *testing.T) { |
There was a problem hiding this comment.
is TestVerifyContractWithSchemaMissingRegoValidator and TestVerifyContractWithSchemaMinimalConfidentialContainers verifying same case?
There was a problem hiding this comment.
No
In TestVerifyContractWithSchemaMissingRegoValidator --> regovalidator parameter is missing which will cause the validation failure
In TestVerifyContractWithSchemaMinimalConfidentialContainers --> regovalidator field is present what policy which is required under regovalidator is missing , its one of the test case which validates the instead fields.
|
Hey @Rohit-Singh43-1 , there are some conflicts due to latest changes. Please fix them. |
c3f3859 to
eaaa2dd
Compare
Signed-off-by: Rohit.Singh43@ibm.com <Rohit.Singh43@ibm.com>
eaaa2dd to
fe9e348
Compare
Sashwat-K
left a comment
There was a problem hiding this comment.
Nice work @Rohit-Singh43-1
|
Thank you @Rohit-Singh43-1 for adding this feature |
|
🎉 This PR is included in version 2.17.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Description
contract with confidential container parameter under env or workload section will be validated against new schema.
Related Issue
Fixes #191
Type of Change
Target Platform
Testing
make testpassesmake fmtapplied (no formatting changes needed)Checklist
make test)