+ os.Setenv("MR_HOST", "mrHost")
+ os.Setenv("MR_PORT", "3908")
+ t.Cleanup(func() {
+ os.Clearenv()
+ })
+ wantConfig := Config{
+ LogLevel: "Debug",
+ InfoProducerHost: "producerHost",
+ InfoProducerPort: 8095,
+ InfoCoordinatorAddress: "infoCoordAddr",
+ MRHost: "mrHost",
+ MRPort: 3908,
+ }
+ if got := New(); !reflect.DeepEqual(got, &wantConfig) {
+ t.Errorf("New() = %v, want %v", got, &wantConfig)
+ }
+}
+
+func TestNew_faultyIntValueSetConfigContainDefaultValueAndWarnInLog(t *testing.T) {
+ assertions := require.New(t)
+ var buf bytes.Buffer
+ log.SetOutput(&buf)
+
+ os.Setenv("INFO_PRODUCER_PORT", "wrong")
+ t.Cleanup(func() {
+ log.SetOutput(os.Stderr)
+ os.Clearenv()
+ })