Skip to content

Commit b7b04fe

Browse files
authored
avro -> v1.7.7.6. fix+expand on tests (#795)
1 parent d4d6264 commit b7b04fe

File tree

3 files changed

+33
-10
lines changed

3 files changed

+33
-10
lines changed

src/Confluent.SchemaRegistry.Serdes/Confluent.SchemaRegistry.Serdes.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</PropertyGroup>
2121

2222
<ItemGroup>
23-
<PackageReference Include="Confluent.Apache.Avro" Version="1.7.7.5" />
23+
<PackageReference Include="Confluent.Apache.Avro" Version="1.7.7.6" />
2424
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
2525
</ItemGroup>
2626

test/Confluent.SchemaRegistry.Serdes.IntegrationTests/Tests/AutoRegisterSchemaDisabled.cs

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,30 @@ public static void AutoRegisterSchemaDisabled(string bootstrapServers, string sc
6363
{
6464
Assert.Throws<SerializationException>(() =>
6565
{
66+
string guidTopic = new Guid().ToString();
6667
try
6768
{
6869
producer
69-
.ProduceAsync(new Guid().ToString(), new Message<string, int> { Key = "test", Value = 112 })
70-
.Wait();
70+
.ProduceAsync(guidTopic, new Message<string, int> { Key = "test", Value = 112 })
71+
.GetAwaiter()
72+
.GetResult();
7173
}
72-
catch (AggregateException e)
74+
catch (Exception e)
7375
{
76+
Assert.True(e is ProduceException<string, int>);
77+
Assert.Equal(ErrorCode.Local_ValueSerialization, ((ProduceException<string, int>)e).Error.Code);
78+
79+
// Test message fields are appropriately set in the case of a serialization error.
80+
Assert.Equal("test", ((ProduceException<string, int>)e).DeliveryResult.Key);
81+
Assert.Equal(112, ((ProduceException<string, int>)e).DeliveryResult.Value);
82+
Assert.Equal(Offset.Invalid, ((ProduceException<string, int>)e).DeliveryResult.Offset);
83+
Assert.Equal(Partition.Any, ((ProduceException<string, int>)e).DeliveryResult.Partition);
84+
Assert.Equal(guidTopic, ((ProduceException<string, int>)e).DeliveryResult.Topic);
85+
Assert.Equal(PersistenceStatus.NotPersisted, ((ProduceException<string, int>)e).DeliveryResult.PersistenceStatus);
86+
Assert.Equal(Timestamp.Default, ((ProduceException<string, int>)e).DeliveryResult.Timestamp);
87+
Assert.Null(((ProduceException<string, int>)e).DeliveryResult.Headers);
88+
89+
// should be SerializationException.
7490
throw e.InnerException;
7591
}
7692
});
@@ -89,10 +105,13 @@ public static void AutoRegisterSchemaDisabled(string bootstrapServers, string sc
89105
{
90106
try
91107
{
92-
producer.ProduceAsync(topic.Name, new Message<string, int> { Key = "test", Value = 112 }).Wait();
108+
producer.ProduceAsync(topic.Name, new Message<string, int> { Key = "test", Value = 112 })
109+
.GetAwaiter()
110+
.GetResult();
93111
}
94-
catch (AggregateException e)
112+
catch (Exception e)
95113
{
114+
Assert.True(e is ProduceException<string, int>);
96115
throw e.InnerException;
97116
}
98117
});

test/Confluent.SchemaRegistry.Serdes.IntegrationTests/Tests/ProduceIncompatibleTypes.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,12 @@ public static void ProduceIncompatibleTypes(string bootstrapServers, string sche
7777
{
7878
producer
7979
.ProduceAsync(topic, new Message<int, string> { Key = 42, Value = "world" })
80-
.Wait();
80+
.GetAwaiter()
81+
.GetResult();
8182
}
82-
catch (AggregateException e)
83+
catch (Exception e)
8384
{
85+
Assert.True(e is ProduceException<int, string>);
8486
throw e.InnerException;
8587
}
8688
});
@@ -99,10 +101,12 @@ public static void ProduceIncompatibleTypes(string bootstrapServers, string sche
99101
{
100102
producer
101103
.ProduceAsync(topic, new Message<string, int> { Key = "world", Value = 42 })
102-
.Wait();
104+
.GetAwaiter()
105+
.GetResult();
103106
}
104-
catch (AggregateException e)
107+
catch (Exception e)
105108
{
109+
Assert.True(e is ProduceException<string, int>);
106110
throw e.InnerException;
107111
}
108112
});

0 commit comments

Comments
 (0)