Hyperproof has a feature called Automated Controls Testing, where our users can write tests against data fetched from our Hypersyncs (integrations).
This allows our customers to continually check their compliance in an automated and hands-free manner.
An example we can use are tests defined to ensure our customers’ employees are following password and two-factor policies required by their compliance frameworks.
The data from these automations gets parsed, packaged into a job, and sent off to a priority queue to get processed and return a result.
The priority queue is based on the role of the user who submitted the test. Admins get faster results, while users get slower results.
Processing the job means taking the job’s data, running it against our pre-defined test (aka a tester function), and returning a result.
Goals:
- define a job
- a job processor
- and a way to run a test against a job’s data
这题的核心是设计一个带优先级的作业处理流程:将自动化测试请求封装成 job,根据提交者角色(如 admin 与普通 user)放入不同优先级队列,再由 job processor 取出并执行预定义的 tester function,对 job data 进行校验并返回结果。实现时通常会把 job 建模为包含数据、测试函数和提交者信息的对象,处理器负责调度和执行,重点考察面向对象设计、队列 / 优先队列的使用,以及如何把业务规则(不同角色不同优先级)抽象成可维护的结构。