Skip to content

Commit

Permalink
Upgrade simulation schema version to v5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
tommysitu committed Jul 11, 2024
1 parent af5fb19 commit ce2035e
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion core/handlers/v2/simulation_views.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ type MetaView struct {
func NewMetaView(version string) *MetaView {
return &MetaView{
HoverflyVersion: version,
SchemaVersion: "v5.2",
SchemaVersion: "v5.3",
TimeExported: time.Now().Format(time.RFC3339),
}
}
Expand Down
6 changes: 3 additions & 3 deletions core/handlers/v2/simulation_views_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func Test_NewSimulationViewFromRequestBody_CanCreateSimulationFromV3Payload(t *t
Expect(simulation.GlobalActions.DelaysLogNormal[0].Mean).To(Equal(3))
Expect(simulation.GlobalActions.DelaysLogNormal[0].Median).To(Equal(2))

Expect(simulation.SchemaVersion).To(Equal("v5.2"))
Expect(simulation.SchemaVersion).To(Equal("v5.3"))
Expect(simulation.HoverflyVersion).To(Equal("v0.11.0"))
Expect(simulation.TimeExported).To(Equal("2017-02-23T12:43:48Z"))
}
Expand Down Expand Up @@ -135,7 +135,7 @@ func Test_NewSimulationViewFromRequestBody_CanCreateSimulationFromV2Payload(t *t
Expect(simulation.GlobalActions.DelaysLogNormal[0].Mean).To(Equal(3))
Expect(simulation.GlobalActions.DelaysLogNormal[0].Median).To(Equal(2))

Expect(simulation.SchemaVersion).To(Equal("v5.2"))
Expect(simulation.SchemaVersion).To(Equal("v5.3"))
Expect(simulation.HoverflyVersion).To(Equal("v0.11.0"))
Expect(simulation.TimeExported).To(Equal("2017-02-23T12:43:48Z"))
}
Expand Down Expand Up @@ -227,7 +227,7 @@ func Test_NewSimulationViewFromRequestBody_CanCreateSimulationFromV1Payload(t *t
Expect(simulation.RequestResponsePairs[0].Response.Status).To(Equal(200))
Expect(simulation.RequestResponsePairs[0].Response.Templated).To(BeFalse())

Expect(simulation.SchemaVersion).To(Equal("v5.2"))
Expect(simulation.SchemaVersion).To(Equal("v5.3"))
Expect(simulation.HoverflyVersion).To(Equal("v0.11.0"))
Expect(simulation.TimeExported).To(Equal("2017-02-23T12:43:48Z"))
}
Expand Down
2 changes: 1 addition & 1 deletion core/handlers/v2/simulation_views_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func v2GetMatchersFromRequestFieldMatchersView(requestFieldMatchers *RequestFiel

func newMetaView(originalMeta MetaView) MetaView {
return MetaView{
SchemaVersion: "v5.2",
SchemaVersion: "v5.3",
HoverflyVersion: originalMeta.HoverflyVersion,
TimeExported: originalMeta.TimeExported,
}
Expand Down
6 changes: 3 additions & 3 deletions core/handlers/v2/simulation_views_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func Test_upgradeV1_ReturnsAnUpgradedSimulation(t *testing.T) {
Expect(upgradedSimulation.RequestResponsePairs[0].Response.EncodedBody).To(BeFalse())
Expect(upgradedSimulation.RequestResponsePairs[0].Response.Headers).To(HaveKeyWithValue("Test", []string{"headers"}))

Expect(upgradedSimulation.SchemaVersion).To(Equal("v5.2"))
Expect(upgradedSimulation.SchemaVersion).To(Equal("v5.3"))
Expect(upgradedSimulation.HoverflyVersion).To(Equal("test"))
Expect(upgradedSimulation.TimeExported).To(Equal("today"))
}
Expand Down Expand Up @@ -299,7 +299,7 @@ func Test_upgradeV2_ReturnsAnUpgradedSimulation(t *testing.T) {
Expect(upgradedSimulation.RequestResponsePairs[0].Response.EncodedBody).To(BeFalse())
Expect(upgradedSimulation.RequestResponsePairs[0].Response.Headers).To(HaveKeyWithValue("Test", []string{"headers"}))

Expect(upgradedSimulation.SchemaVersion).To(Equal("v5.2"))
Expect(upgradedSimulation.SchemaVersion).To(Equal("v5.3"))
Expect(upgradedSimulation.HoverflyVersion).To(Equal("test"))
Expect(upgradedSimulation.TimeExported).To(Equal("today"))
}
Expand Down Expand Up @@ -507,7 +507,7 @@ func Test_upgradeV4_ReturnsAnUpgradedSimulation(t *testing.T) {
Expect(upgradedSimulation.RequestResponsePairs[0].Response.EncodedBody).To(BeFalse())
Expect(upgradedSimulation.RequestResponsePairs[0].Response.Headers).To(HaveKeyWithValue("Test", []string{"headers"}))

Expect(upgradedSimulation.SchemaVersion).To(Equal("v5.2"))
Expect(upgradedSimulation.SchemaVersion).To(Equal("v5.3"))
Expect(upgradedSimulation.HoverflyVersion).To(Equal("test"))
Expect(upgradedSimulation.TimeExported).To(Equal("today"))
}
Expand Down
4 changes: 2 additions & 2 deletions core/hoverfly_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func Test_Hoverfly_GetSimulation_ReturnsBlankSimulation_ifThereIsNoData(t *testi
Expect(simulation.RequestResponsePairs).To(HaveLen(0))
Expect(simulation.GlobalActions.Delays).To(HaveLen(0))

Expect(simulation.MetaView.SchemaVersion).To(Equal("v5.2"))
Expect(simulation.MetaView.SchemaVersion).To(Equal("v5.3"))
Expect(simulation.MetaView.HoverflyVersion).To(MatchRegexp(`v\d+.\d+.\d+(-rc.\d)*`))
Expect(simulation.MetaView.TimeExported).ToNot(BeNil())
}
Expand Down Expand Up @@ -423,7 +423,7 @@ func Test_Hoverfly_GetFilteredSimulation_ReturnBlankSimulation_IfThereIsNoMatch(
Expect(simulation.GlobalActions.Delays).To(HaveLen(0))
Expect(simulation.GlobalActions.DelaysLogNormal).To(HaveLen(0))

Expect(simulation.MetaView.SchemaVersion).To(Equal("v5.2"))
Expect(simulation.MetaView.SchemaVersion).To(Equal("v5.3"))
Expect(simulation.MetaView.HoverflyVersion).To(MatchRegexp(`v\d+.\d+.\d+(-rc.\d)*`))
Expect(simulation.MetaView.TimeExported).ToNot(BeNil())
}
Expand Down
4 changes: 2 additions & 2 deletions functional-tests/core/api/simulation_api_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var _ = Describe("/api/v2/simulation", func() {
Expect(err).To(BeNil())
schemaVersion, err := metaObject.GetString("schemaVersion")
Expect(err).To(BeNil())
Expect(schemaVersion).To(Equal("v5.2"))
Expect(schemaVersion).To(Equal("v5.3"))
hoverflyVersion, err := metaObject.GetString("hoverflyVersion")
Expect(err).To(BeNil())
Expect(hoverflyVersion).ToNot(BeNil())
Expand Down Expand Up @@ -173,7 +173,7 @@ var _ = Describe("/api/v2/simulation", func() {
Expect(err).To(BeNil())
schemaVersion, err := metaObject.GetString("schemaVersion")
Expect(err).To(BeNil())
Expect(schemaVersion).To(Equal("v5.2"))
Expect(schemaVersion).To(Equal("v5.3"))
hoverflyVersion, err := metaObject.GetString("hoverflyVersion")
Expect(err).To(BeNil())
Expect(hoverflyVersion).ToNot(BeNil())
Expand Down
2 changes: 1 addition & 1 deletion functional-tests/hoverctl/import_export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ var _ = Describe("When I use hoverctl", func() {

hoverflySimulation = `"pairs":[{"labels":["create","bookings"],"request":{"path":[{"matcher":"exact","value":"/api/bookings"}],"method":[{"matcher":"exact","value":"POST"}],"destination":[{"matcher":"exact","value":"www.my-test.com"}],"scheme":[{"matcher":"exact","value":"http"}],"body":[{"matcher":"exact","value":"{\"flightId\": \"1\"}"}],"headers":{"Content-Type":[{"matcher":"exact","value":"application/json"}]}},"response":{"status":201,"body":"","encodedBody":false,"headers":{"Location":["http://localhost/api/bookings/1"]},"templated":false}}],"globalActions":{"delays":[],"delaysLogNormal":[]}}`

hoverflyMeta = `"meta":{"schemaVersion":"v5.2","hoverflyVersion":"v\d+.\d+.\d+(-rc.\d)*","timeExported":`
hoverflyMeta = `"meta":{"schemaVersion":"v5.3","hoverflyVersion":"v\d+.\d+.\d+(-rc.\d)*","timeExported":`
)

Describe("with a running hoverfly", func() {
Expand Down

0 comments on commit ce2035e

Please sign in to comment.