Skip to content

sourcegraph: add golden test for selectors and volume claim templates - #1014

Merged
marcleblanc2 merged 4 commits into
marc/selector-labelsfrom
review/selector-labels-dedupe
Nov 11, 2026
Merged

marcleblanc2 merged 4 commits into
marc/selector-labelsfrom
review/selector-labels-dedupe

Conversation

@michaellzc

@michaellzc michaellzc commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #1007 from review. #1007 changes the helper behind every selector, and its tests would still pass if a default selector changed, which would break helm upgrade of every existing release. This adds a golden test recorded on 33c9ef8, before #1007, that snapshots every workload selector, pod label set, volume claim template, and Service and PodDisruptionBudget selector.

Checklist

Test plan

michaellzc and others added 2 commits November 11, 2026 20:26
Snapshots of every workload selector, pod labels, volume claim template, and
Service and PodDisruptionBudget selector, recorded on 33c9ef8 (before the
opt-in selector labels), so a change that would break helm upgrade of an
existing release fails the tests.

Amp-Thread-ID: https://ampcode.com/threads/T-de6ef54a-e04e-4aeb-9ed5-101ed382c9bf
Co-authored-by: Amp <amp@ampcode.com>
A custom selector label that repeats app.kubernetes.io/name or
app.kubernetes.io/instance, a podLabels key that repeats a selector label,
and indexedSearch.storageLabels.deploy rendered the key twice, and the last
value won. Selector labels are now merged into one map, podLabels skip keys
the selector labels already set, and a different value fails the render,
because it would stop the workload selector from matching its pods.

Amp-Thread-ID: https://ampcode.com/threads/T-de6ef54a-e04e-4aeb-9ed5-101ed382c9bf
Co-authored-by: Amp <amp@ampcode.com>
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

michaellzc and others added 2 commits November 11, 2026 22:09
Drop sourcegraph.extraPodLabels and its tests. A podLabels key that repeats
a selector label renders twice already on main, so fixing it is outside this
change; the selector and storage label fixes stay.

Amp-Thread-ID: https://ampcode.com/threads/T-de6ef54a-e04e-4aeb-9ed5-101ed382c9bf
Co-authored-by: Amp <amp@ampcode.com>
Revert the selector label merge and the indexedSearch.storageLabels.deploy
check with their tests. Both only affect custom values that conflict with
labels the chart sets, and render consistently with Helm. Keep the golden
test.

Amp-Thread-ID: https://ampcode.com/threads/T-de6ef54a-e04e-4aeb-9ed5-101ed382c9bf
Co-authored-by: Amp <amp@ampcode.com>
@michaellzc michaellzc changed the title sourcegraph: render repeated selector labels once, add selector golden test sourcegraph: add golden test for selectors and volume claim templates Nov 11, 2026
@marcleblanc2
marcleblanc2 merged commit 76eeccd into marc/selector-labels Nov 11, 2026
5 checks passed
@marcleblanc2
marcleblanc2 deleted the review/selector-labels-dedupe branch November 11, 2026 22:51
marcleblanc2 pushed a commit that referenced this pull request Nov 13, 2026
…#1014)

Follow-up to #1007 from review. #1007 changes the helper behind every
selector, and its tests would still pass if a default selector changed,
which would break `helm upgrade` of every existing release. This adds a
golden test recorded on `33c9ef8`, before #1007, that snapshots every
workload selector, pod label set, volume claim template, and Service and
PodDisruptionBudget selector.

### Checklist

- [x] Follow the [manual testing
process](https://github.com/sourcegraph/deploy-sourcegraph-helm/blob/main/TEST.md):
test-only change
- [ ] Update
[changelog](https://github.com/sourcegraph/deploy-sourcegraph-helm/blob/main/charts/sourcegraph/CHANGELOG.md):
not needed, test only
- [ ] Update [Kubernetes update
doc](https://docs.sourcegraph.com/admin/updates/kubernetes): not needed

### Test plan

- The golden test (108 snapshots, with jaeger, syntactic-code-intel, all
10 PDBs, 2 worker replicas, and a `podLabels` case) passes unchanged on
#1007.
- It fails on mutations that change default selectors or labels, such as
the frontend selector losing `app.kubernetes.io/name`/`instance`, which
#1007's own tests miss.

---------

Co-authored-by: Amp <amp@ampcode.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants