Skip to content

Commit

Permalink
fix(coordinator): fix config marshaling error (#560)
Browse files Browse the repository at this point in the history
### Motivation 

Fix coordinator config marshalling error.


### Modification

- filter unsupported json type
  • Loading branch information
mattisonchao authored Nov 5, 2024
1 parent 9a1b781 commit c74352c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
8 changes: 4 additions & 4 deletions coordinator/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ import (
type Config struct {
InternalServiceAddr string
InternalSecureServiceAddr string
PeerTLS *tls.Config
ServerTLS *tls.Config
PeerTLS *tls.Config `json:"-"`
ServerTLS *tls.Config `json:"-"`
MetricsServiceAddr string
MetadataProviderImpl MetadataProviderImpl
K8SMetadataNamespace string
K8SMetadataConfigMapName string
FileMetadataPath string
ClusterConfigProvider func() (model.ClusterConfig, error)
ClusterConfigChangeNotifications chan any
ClusterConfigProvider func() (model.ClusterConfig, error) `json:"-"`
ClusterConfigChangeNotifications chan any `json:"-"`
}

type MetadataProviderImpl string
Expand Down
32 changes: 32 additions & 0 deletions coordinator/coordinator_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2024 StreamNative, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package coordinator

import (
"encoding/json"
"github.com/stretchr/testify/assert"
"testing"
)

func TestCoordinator_MarshalingError(t *testing.T) {
config := Config{
InternalServiceAddr: "123",
InternalSecureServiceAddr: "123",
MetadataProviderImpl: "123",
K8SMetadataConfigMapName: "123",
}
_, err := json.Marshal(config)
assert.Nil(t, err)
}

0 comments on commit c74352c

Please sign in to comment.