Better code testing (internal)

TJ Banghart · Friday Demos · April 11, 2025 · 2:45

We're improving our test coverage for data filters to make sure we can keep building quickly while minimizing negative customer impact or regressions.

Transcript

This transcript is auto-generated. Names and product terms may be wrong.

  1. Oh. Um, yeah, I don't really have like a feature, but it's related to something that has bothered me for a while, both here and at Looker. Um, like last couple weeks, um, merged some changes that broke relative date filtering. And it's always unfortunate when that happens. We shouldn't be doing that. Um, and I think one of the reasons why this this keeps happening is all of our test data goes up to 2020.

  2. So all the unit tests, all the dialect tests are based on dates that end in 2020. So the relative filters, you have to filter pretty far back in the past to get any real results. Um, earlier this week, I added a view to all of the dialect or the X dialect test databases that takes that original data set and shifts it to be centered around the current time stamp.

  3. Um so now you can have unit tests that actually get results with relative filters which is for me like a huge relief that when we are making changes to filters we can have uh you know relative filter unit tests that actually have results. Um, and it's based off of this kind of cool, well, in retrospect it seemed obvious, but when I was trying to figure out how I'm going to shift that data and always have it be, uh, always have like actual results based around the current time stamp, um, it was a little tricky at first, but then you take the median of the original data set, subtract it from the current time stamp, and then add it back to the original data, and you

  4. have this distribution that's that's centered around um, the original data And then with that, I added a ton of relative state filter tests that test every type of model configuration. So, we're not going to get um you know, cast exceptions going into production that are like, oh, you missed adding a fiscal offset for this test or you missed uh a week start day.

  5. Um, so I'm I'm very stoked on that that we have some coverage there and hopefully for bug repros we can just use these these new uh relative uh data sets for that. Uh TJ, also worth mentioning that technique that you used to offset the timestamps is super helpful for demo data. Um so if we're synthesizing uh demo data sets for the field um just generate once and then uh put that view layer on top using that same technique and it's basically uh perpetually awesome.

  6. So we would love to steal some of that code from you in the future.