bug(scheduler): Fix controller id length check (#2226)
* bug(scheduler): Fix controller id length check The job_run table has a foreign key to the server_controller private_id. While this column is called a prviate_id it does not implement the wt_private_id postgres domain type, and therefore does not have a minimum length of 10 characters.
This commit is contained in:
1 parent
86141ffb65
commit
4cacd0a605
8 files changed
+211
-5
No files matched your search
@@ -0,0 +1,33 @@
|
||||
-- controller_id tests:
|
||||
-- validates the wt_controller_id domain
|
||||
|
||||
begin;
|
||||
select plan(8);
|
||||
|
||||
select has_domain('wt_controller_id');
|
||||
|
||||
create table controller_id_testing (
|
||||
id wt_controller_id
|
||||
);
|
||||
|
||||
prepare empty_insert as insert into controller_id_testing (id) values ('');
|
||||
SELECT throws_like(
|
||||
'empty_insert',
|
||||
'%"wt_controller_id_check"',
|
||||
'We should error for empty controller id'
|
||||
);
|
||||
|
||||
prepare null_insert as insert into controller_id_testing (id) values (null);
|
||||
select lives_ok('null_insert');
|
||||
select is(count(*), 1::bigint) from controller_id_testing where id is null;
|
||||
|
||||
prepare valid_insert as insert into controller_id_testing (id) values ('test-controller-id');
|
||||
select lives_ok('valid_insert');
|
||||
select is(count(*), 1::bigint) from controller_id_testing where id = 'test-controller-id';
|
||||
|
||||
prepare short_insert as insert into controller_id_testing (id) values ('_');
|
||||
select lives_ok('short_insert');
|
||||
select is(count(*), 1::bigint) from controller_id_testing where id = '_';
|
||||
|
||||
select * from finish();
|
||||
rollback;
|
||||
Reference in new issue
Block a user