Fix billing pipeline first month scheduling (#1891)

* Fix billing pipeline first month scheduling

* compare to expansion next month

* use yoda date comparison

* update cursor time to be mid of day
This commit is contained in:
Pavlo Tkach 2023-01-05 21:45:56 -05:00 committed by GitHub
parent 9d38328caa
commit b7bbf85ad2
2 changed files with 25 additions and 1 deletions

View file

@ -168,4 +168,28 @@ class GenerateInvoicesActionTest extends BeamActionTestBase {
+ " terminating invoicing pipeline");
cloudTasksHelper.assertNoTasksEnqueued("beam-reporting");
}
@Test
void testSucceedsToGenerateInvoicesFirstDayOfTheYear() throws Exception {
persistResource(Cursor.createGlobal(RECURRING_BILLING, DateTime.parse("2017-01-01T13:15:00Z")));
action =
new GenerateInvoicesAction(
"test-project",
"test-region",
"staging_bucket",
"billing_bucket",
"REG-INV",
false,
new YearMonth(2016, 12),
emailUtils,
cloudTasksUtils,
clock,
response,
dataflow);
action.run();
assertThat(response.getContentType()).isEqualTo(MediaType.PLAIN_TEXT_UTF_8);
assertThat(response.getStatus()).isEqualTo(SC_OK);
assertThat(response.getPayload()).isEqualTo("Launched invoicing pipeline: jobid");
cloudTasksHelper.assertNoTasksEnqueued("beam-reporting");
}
}