aperture icon indicating copy to clipboard operation
aperture copied to clipboard

Rudimentary unit tests for Validation and Defaults behavior on Policy config

Open tanveergill opened this issue 2 years ago • 0 comments

Why

  • This test detects whether Validation or Defaults are completely broken

What

  • Write tests here: https://github.com/fluxninja/aperture/blob/main/pkg/policies/controlplane/validator_test.go
  • Start with a super policy with all the pieces required for following unit tests.
  • The super policy should not generate an error when passed through policyValidator.ValidateObject
  • Modify the super policy for each unit test

Defaults Tests

  • Check that PromQL.evaludation_interval defaults to 10s when unset

Validation Tests

  • Remove ConcurrencyLimiter.selector and check that error occurs
  • Set WorkloadParameters.priority as 2000 and check that error occurs

tanveergill avatar Oct 07 '22 19:10 tanveergill