Skip to content

Commit bb7366a

Browse files
authored
Add git-sourced Smart Tests as examples + update hotrod images to point to latest (#274)
* default to hotrod-istio and allow override using label to hotrod-devmesh * added signadot config files and starlark tests * add label files for organization * add smart-tests that always run for all sandboxes * add newline * rm quickstart manifest and make base manifest point to latest * change label, make dummy change to route svc * remove unexpected character * no-op changes to all the services * tag-release-latest * fix how we push tags * rm the linux-amd64 suffix * still push amd64
1 parent 15ed10c commit bb7366a

File tree

13 files changed

+97
-75
lines changed

13 files changed

+97
-75
lines changed

.github/workflows/build.yml

Lines changed: 34 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ jobs:
119119
echo "Checking for labels..."
120120
LABELS="${{ toJSON(github.event.pull_request.labels.*.name) }}"
121121
echo "Labels on PR: $LABELS"
122-
if [[ "$LABELS" == *"istio"* ]]; then
123-
echo "Found istio label"
124-
NAMESPACE="hotrod-istio"
125-
else
126-
echo "istio label not found"
122+
if [[ "$LABELS" == *"devmesh"* ]]; then
123+
echo "Found devmesh label"
127124
NAMESPACE="hotrod-devmesh"
125+
else
126+
echo "Using default namespace"
127+
NAMESPACE="hotrod-istio"
128128
fi
129129
echo "Using namespace=${NAMESPACE}"
130130
echo "NAMESPACE=${NAMESPACE}" >> "$GITHUB_ENV"
@@ -142,7 +142,11 @@ jobs:
142142
-f - \
143143
< ${GITHUB_WORKSPACE}/.signadot/sbx-gh-template.yaml
144144
145-
- name: Run Tests
145+
- name: Run Smart Tests
146+
run: |
147+
signadot st run --sandbox=${SANDBOX_NAME} --publish
148+
149+
- name: Run Integration Tests using Signadot Local Proxy
146150
run: |
147151
# Run the proxy
148152
echo "Starting signadot proxy..."
@@ -194,12 +198,12 @@ jobs:
194198
echo "Checking for labels..."
195199
LABELS="${{ toJSON(github.event.pull_request.labels.*.name) }}"
196200
echo "Labels on PR: $LABELS"
197-
if [[ "$LABELS" == *"istio"* ]]; then
198-
echo "Found istio label"
199-
NAMESPACE="hotrod-istio"
200-
else
201-
echo "istio label not found"
201+
if [[ "$LABELS" == *"devmesh"* ]]; then
202+
echo "Found devmesh label"
202203
NAMESPACE="hotrod-devmesh"
204+
else
205+
echo "Using default namespace"
206+
NAMESPACE="hotrod-istio"
203207
fi
204208
echo "Using namespace=${NAMESPACE}"
205209
echo "NAMESPACE=${NAMESPACE}" >> "$GITHUB_ENV"
@@ -217,27 +221,9 @@ jobs:
217221
-f - \
218222
< ${GITHUB_WORKSPACE}/.signadot/sbx-gh-template.yaml
219223
220-
- name: Run Tests
224+
- name: Run Smart Tests
221225
run: |
222-
# Run the proxy
223-
echo "Starting signadot proxy..."
224-
signadot local proxy --sandbox ${SANDBOX_NAME} \
225-
--map http://frontend.${NAMESPACE}:8080@localhost:38080 > /tmp/signadot-proxy.log &
226-
PROXY_PID=$!
227-
sleep 1
228-
cat /tmp/signadot-proxy.log
229-
230-
# Run integration tests
231-
echo "Executing tests..."
232-
go install github.com/jstemmer/go-junit-report/v2@latest
233-
TEST_FRONTEND_ADDR=localhost:38080 TEST_TARGET_WORKLOAD=frontend TEST_SANDBOX_NAME=${SANDBOX_NAME} go test -v \
234-
${GITHUB_WORKSPACE}/services/frontend/ | go-junit-report -set-exit-code -out integration-report.xml
235-
236-
# Stop the proxy
237-
echo "Stopping signadot proxy..."
238-
cat /tmp/signadot-proxy.log
239-
kill ${PROXY_PID}
240-
226+
signadot st run --sandbox=${SANDBOX_NAME} --publish
241227
242228
sandbox-location:
243229
runs-on: ubuntu-latest
@@ -265,12 +251,12 @@ jobs:
265251
echo "Checking for labels..."
266252
LABELS="${{ toJSON(github.event.pull_request.labels.*.name) }}"
267253
echo "Labels on PR: $LABELS"
268-
if [[ "$LABELS" == *"istio"* ]]; then
269-
echo "Found istio label"
270-
NAMESPACE="hotrod-istio"
271-
else
272-
echo "istio label not found"
254+
if [[ "$LABELS" == *"devmesh"* ]]; then
255+
echo "Found devmesh label"
273256
NAMESPACE="hotrod-devmesh"
257+
else
258+
echo "Using default namespace"
259+
NAMESPACE="hotrod-istio"
274260
fi
275261
echo "Using namespace=${NAMESPACE}"
276262
echo "NAMESPACE=${NAMESPACE}" >> "$GITHUB_ENV"
@@ -288,6 +274,11 @@ jobs:
288274
-f - \
289275
< ${GITHUB_WORKSPACE}/.signadot/sbx-gh-template.yaml
290276
277+
278+
- name: Run Smart Tests
279+
run: |
280+
signadot st run --sandbox=${SANDBOX_NAME} --publish
281+
291282
sandbox-driver:
292283
runs-on: ubuntu-latest
293284
if: ${{ github.event_name == 'pull_request' && needs.changes.outputs.driver == 'true' }}
@@ -314,12 +305,12 @@ jobs:
314305
echo "Checking for labels..."
315306
LABELS="${{ toJSON(github.event.pull_request.labels.*.name) }}"
316307
echo "Labels on PR: $LABELS"
317-
if [[ "$LABELS" == *"istio"* ]]; then
318-
echo "Found istio label"
319-
NAMESPACE="hotrod-istio"
320-
else
321-
echo "istio label not found"
308+
if [[ "$LABELS" == *"devmesh"* ]]; then
309+
echo "Found devmesh label"
322310
NAMESPACE="hotrod-devmesh"
311+
else
312+
echo "Using default namespace"
313+
NAMESPACE="hotrod-istio"
323314
fi
324315
echo "Using namespace=${NAMESPACE}"
325316
echo "NAMESPACE=${NAMESPACE}" >> "$GITHUB_ENV"
@@ -337,23 +328,6 @@ jobs:
337328
-f - \
338329
< ${GITHUB_WORKSPACE}/.signadot/sbx-gh-template.yaml
339330
340-
- name: Run Tests
331+
- name: Run Smart Tests
341332
run: |
342-
# Run the proxy
343-
echo "Starting signadot proxy..."
344-
signadot local proxy --sandbox ${SANDBOX_NAME} \
345-
--map http://frontend.${NAMESPACE}:8080@localhost:38080 > /tmp/signadot-proxy.log &
346-
PROXY_PID=$!
347-
sleep 1
348-
cat /tmp/signadot-proxy.log
349-
350-
# Run integration tests
351-
echo "Executing tests..."
352-
go install github.com/jstemmer/go-junit-report/v2@latest
353-
TEST_FRONTEND_ADDR=localhost:38080 TEST_TARGET_WORKLOAD=driver TEST_SANDBOX_NAME=${SANDBOX_NAME} go test -v \
354-
${GITHUB_WORKSPACE}/services/frontend/ | go-junit-report -set-exit-code -out integration-report.xml
355-
356-
# Stop the proxy
357-
echo "Stopping signadot proxy..."
358-
cat /tmp/signadot-proxy.log
359-
kill ${PROXY_PID}
333+
signadot st run --sandbox=${SANDBOX_NAME} --publish

.signadot/config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
smart_tests:
2+
- smart-tests/

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ release: build-release release-images.txt tag-release
5858
GOOS=$$os GOARCH=$$arch $(MAKE) push-docker; \
5959
done; \
6060
done;
61-
$(DOCKER) manifest create --amend signadot/hotrod:$(RELEASE_TAG) \
61+
# Remove existing manifest if it exists to ensure a fresh state
62+
$(DOCKER) manifest rm signadot/hotrod:$(RELEASE_TAG) || true
63+
# Create a new manifest with the freshly built images
64+
$(DOCKER) manifest create signadot/hotrod:$(RELEASE_TAG) \
6265
$(shell cat dist/release-images.txt)
6366
$(DOCKER) manifest push signadot/hotrod:$(RELEASE_TAG)
6467

k8s/base/kustomization.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ resources:
88
- location.yaml
99
- driver.yaml
1010
- route.yaml
11-
1211
images:
1312
- name: signadot/hotrod
14-
newTag: quickstart-v5-fix
13+
newTag: latest

k8s/overlays/prod/quickstart/kustomization.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

pkg/config/route.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func GetRouteCalcDelay() time.Duration {
2424
return dur
2525
}
2626

27-
// the standard deviation
27+
// GetRouteCalcStdDev calculates the standard deviation
2828
func GetRouteCalcStdDev() time.Duration {
2929
return GetRouteCalcDelay() / 4
3030
}

services/driver/consumer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type Consumer struct {
3636
func newConsumer(ctx context.Context, tracerProvider trace.TracerProvider,
3737
logger log.Factory) *Consumer {
3838
// create a routesapi baseline watched instance
39+
// TODO: remove this in case we're not running with Signadot
3940
routing, err := watched.BaselineWatchedFromEnv()
4041
if err != nil {
4142
panic(err)

services/frontend/server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ type ConfigOptions struct {
6767

6868
// NewServer creates a new frontend.Server
6969
func NewServer(options ConfigOptions, logger log.Factory) *Server {
70-
// get a tracer provider for the frontend
70+
// get tracer provider for the frontend
7171
tracerProvider := tracing.InitOTEL("frontend", config.GetOtelExporterType(),
7272
config.GetMetricsFactory(), logger)
7373

74-
// get a location client
74+
// get location client
7575
locationClient := location.NewClient(tracerProvider, logger, options.LocationHostPort)
7676

77-
// get a notification handler
77+
// get notification handler
7878
notificationHandler := notifications.NewNotificationHandler(tracerProvider, logger)
7979

8080
// get a dispatcher

services/location/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ type Server struct {
4343
database *database
4444
}
4545

46-
// NewServer creates a new location.Server
46+
// NewServer creates new location.Server
4747
func NewServer(hostPort string, logger log.Factory) *Server {
48-
// get a tracer provider for the location
48+
// get tracer provider for the location
4949
tracerProvider := tracing.InitOTEL("location", config.GetOtelExporterType(),
5050
config.GetMetricsFactory(), logger)
5151

smart-tests/frontend/.labels

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
team=frontend
2+
app=hotrod

0 commit comments

Comments
 (0)