Skip to content

Commit

Permalink
Fix Unit Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AtakanColakSoftwire committed Jun 2, 2022
1 parent 625adfa commit 82507a6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mockSchemaRegistryClient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ func TestMockSchemaRegistryClient_CreateSchema(t *testing.T) {

// Test registering already registered schema
_, err := srClient.CreateSchema("test1-key", schema, Avro)
assert.EqualError(t, err, "POST \"mock://testingUrl/subjects/test1-key/versions\": Schema already registered with id 2")
assert.EqualError(t, err, "POST mock://testingUrl/subjects/test1-key/versions: Schema already registered with id 2")

// Test registering already registered schema
_, err = srClient.CreateSchema("test1_arb", schema3, Avro)
assert.EqualError(t, err, "POST \"mock://testingUrl/subjects/test1_arb/versions\": Schema already registered with id 5")
assert.EqualError(t, err, "POST mock://testingUrl/subjects/test1_arb/versions: Schema already registered with id 5")
}

func TestMockSchemaRegistryClient_GetLatestSchema(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions schemaRegistryClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ func (client *SchemaRegistryClient) GetSchema(schemaID int) (*Schema, error) {
var schema = &Schema{
id: schemaID,
schema: schemaResp.Schema,
version: schemaResp.Version,
schemaType: schemaResp.SchemaType,
codec: codec,
}
Expand Down
4 changes: 2 additions & 2 deletions schemaRegistryClient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestSchemaRegistryClient_CreateSchemaWithoutReferences(t *testing.T) {
assert.Equal(t, bodyToString(req.Body), string(expected))
// Send response to be tested
rw.Write(response)
case "/subjects/test1-value/versions/latest":
case fmt.Sprintf("/schemas/ids/%d", responsePayload.Version):
// Send response to be tested
rw.Write(response)
default:
Expand Down Expand Up @@ -89,7 +89,7 @@ func TestSchemaRegistryClient_CreateSchemaWithoutReferences(t *testing.T) {
assert.Equal(t, bodyToString(req.Body), string(expected))
// Send response to be tested
rw.Write(response)
case "/subjects/test1/versions/latest":
case fmt.Sprintf("/schemas/ids/%d", responsePayload.Version):
// Send response to be tested
rw.Write(response)
default:
Expand Down

0 comments on commit 82507a6

Please sign in to comment.