-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go/network: remove creation publication ID from SNI cache
This prevents a deletion and re-creation of a task with the same name from then failing to resolve, because both the old and new task will share a common shardIDPrefix.
- Loading branch information
1 parent
00996df
commit 6b4a8c8
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package network | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/estuary/flow/go/labels" | ||
"github.com/stretchr/testify/require" | ||
pb "go.gazette.dev/core/broker/protocol" | ||
pc "go.gazette.dev/core/consumer/protocol" | ||
) | ||
|
||
func TestResolveSNIMapping(t *testing.T) { | ||
var ( | ||
parsed = parsedSNI{ | ||
hostname: "abcdefg", | ||
port: "8080", | ||
} | ||
shard = &pc.ShardSpec{ | ||
Id: "capture/AcmeCo/My/Capture/source-http-ingest/0f05593ad1800023/00000000-00000000", | ||
LabelSet: pb.MustLabelSet( | ||
labels.PortProtoPrefix+"8080", "leet", | ||
labels.PortPublicPrefix+"8080", "true", | ||
), | ||
} | ||
) | ||
require.Equal(t, resolvedSNI{ | ||
shardIDPrefix: "capture/AcmeCo/My/Capture/source-http-ingest/", | ||
portProtocol: "leet", | ||
portIsPublic: true, | ||
}, newResolvedSNI(parsed, shard)) | ||
} |