Testing Hub & Spoke Changes
If your Looker project uses the local project imports feature to import other projects from your Looker instance, you can use Spectacles to test downstream projects (spokes) when the upstream project (hub) changes.
For example, let's say you have a company-bi hub project that's imported into the marketing and finance projects.
You can configure a trigger in Spectacles to test the marketing and finance projects whenever a Pull Request (or Merge Request, but we'll use Pull Request) is opened on the company-bi repository.
Configuring the Suite
Ensure you've set up the proper Spectacles integration with your version control provider. For example, configure the integration with GitHub.
Ensure all hub projects are locally imported by the spoke project you want to test. Remote project imports are not supported.
In Spectacles, you configure spoke projects to be tested in Looker production when Pull Requests are opened on one or more hub projects.
If you want changes on the hub project to trigger tests across multiple spoke projects, you will need to configure each spoke accordingly.
- From the Suites page of the spoke project, create a new Suite (or use an existing one, if you prefer).
- Check Trigger on Pull Requests from imported projects.
- Check the boxes for any hub projects that you would like to triggers tests of the current project (the spoke project).
- Configure the Suite by enabling and configuring the validators you'd like to run on changes to the hub projecct.
Incremental mode will be disabled automatically for runs triggered by imported project Pull Requests, regardless of the setting on the Suite. This is because Looker production of the spoke project is tested by default, so there is no Git state to compare incrementally to.
It's also recommended you disable the LookML and Style Validators, as it doesn't make sense to run them on imported project changes, since they aren't affected by these changes.
Let's save the Suite and test it out by making a change to the hub project.
- Scroll to the bottom and update the Suite. Spectacles will create a webhook subscription for Pull Request events on the hub project.
- Create a Pull Request on the hub project. You should see a Spectacles run begin in the spoke project. The result of the run will be written to a status on the hub Pull Request.