Skip to content

Commit

Permalink
Add one more case to cover @latest as part of the traffic split.
Browse files Browse the repository at this point in the history
Followup to the main implementation of knative#2819.
- fix the test comment, to reflect the reality
- add a case where candidate is replaced with @latest
- traffic distribution is validated.
  • Loading branch information
vagababov committed Feb 6, 2019
1 parent 8cdc21d commit 300294e
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions test/conformance/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,15 @@ func TestRunLatestService(t *testing.T) {
}
}

// TestReleaseService creates a Service in runLatest mode and then updates it to release mode. Once in release mode the test
// goes through Update/Validate to try different possible configurations for a release service.
// TestReleaseService creates a Service in `release` mode with the only revision
// being `@latest`. Once this succeeded, the test goes through Update/Validate to
// try different possible configurations for a release service.
// Currently tests for the following combinations
// 1. One Revision Specified, current == latest
// 2. One Revision Specified, current != latset
// 3. Two Revisions Specified, 50% rollout, candidate == latest
// 4. Two Revisions Specified, 50% rollout, candidate != latest
// 5. Two Revisions Specified, 50% rollout, candidate != latest, latest referred to as `@latest`.
func TestReleaseService(t *testing.T) {
// Create Initial Service
clients := setup(t)
Expand Down Expand Up @@ -396,6 +398,20 @@ func TestReleaseService(t *testing.T) {
[]string{expectedFirstRev, expectedSecondRev},
[]string{"latest", "candidate", "current"},
[]string{expectedThirdRev, expectedSecondRev, expectedFirstRev})

// Now update the service to use `@latest` as candidate.
revisions[1] = v1alpha1.ReleaseLatestRevisionKeyword
logger.Info("Updating Service to split traffic between two `current` and `@latest`")
if objects.Service, err = test.PatchReleaseService(logger, clients, objects.Service, revisions, 50); err != nil {
t.Fatalf("Service %s was not updated to release: %v", names.Service, err)
}

// The domains should not change, since configuration was not changed.
validateDomains(t, logger, clients,
names.Domain,
[]string{expectedFirstRev, expectedSecondRev},
[]string{"latest", "candidate", "current"},
[]string{expectedThirdRev, expectedSecondRev, expectedFirstRev})
}

// TODO(jonjohnsonjr): Examples of deploying from source.

0 comments on commit 300294e

Please sign in to comment.