Skip to content
Snippets Groups Projects

Bundle-uri capability: Only advertise when bundle exist

Merged Olivier Campeau requested to merge advertise-bundle-uri into master
All threads resolved!
@@ -10,10 +10,14 @@ import (
"gitlab.com/gitlab-org/gitaly/v16/internal/testhelper"
)
func Test_capabilitiesGitConfig(t *testing.T) {
func TestCapabilitiesGitConfig(t *testing.T) {
t.Parallel()
featureFlagSet := testhelper.NewFeatureSets(featureflag.BundleURI)
testhelper.NewFeatureSets(
featureflag.BundleURI,
).Run(t, testCapabilitiesGitConfig)
}
func testCapabilitiesGitConfig(t *testing.T, ctx context.Context) {
tests := []struct {
desc string
enabled bool
@@ -41,26 +45,29 @@ func Test_capabilitiesGitConfig(t *testing.T) {
},
}
for _, tt := range tests {
featureFlagSet.Run(t, func(t *testing.T, ctx context.Context) {
got := CapabilitiesGitConfig(ctx, tt.enabled)
if featureflag.BundleURI.IsEnabled(ctx) {
require.ElementsMatch(t, tt.expected, got)
} else {
require.ElementsMatch(t, []gitcmd.ConfigPair{
{
Key: "uploadpack.advertiseBundleURIs",
Value: "false",
},
}, got)
}
})
got := CapabilitiesGitConfig(ctx, tt.enabled)
if featureflag.BundleURI.IsEnabled(ctx) {
require.ElementsMatch(t, tt.expected, got)
} else {
require.ElementsMatch(t, []gitcmd.ConfigPair{
{
Key: "uploadpack.advertiseBundleURIs",
Value: "false",
},
}, got)
}
}
}
func Test_uploadPackGitConfig(t *testing.T) {
func TestUploadPackGitConfig(t *testing.T) {
t.Parallel()
featureFlagSet := testhelper.NewFeatureSets(featureflag.BundleURI)
testhelper.NewFeatureSets(
featureflag.BundleURI,
).Run(t, testUploadPackGitConfig)
}
func testUploadPackGitConfig(t *testing.T, ctx context.Context) {
tests := []struct {
desc string
uri string
@@ -108,18 +115,16 @@ func Test_uploadPackGitConfig(t *testing.T) {
},
}
for _, tt := range tests {
featureFlagSet.Run(t, func(t *testing.T, ctx context.Context) {
got := UploadPackGitConfig(ctx, tt.uri)
if featureflag.BundleURI.IsEnabled(ctx) {
require.ElementsMatch(t, tt.expected, got)
} else {
require.ElementsMatch(t, []gitcmd.ConfigPair{
{
Key: "uploadpack.advertiseBundleURIs",
Value: "false",
},
}, got)
}
})
got := UploadPackGitConfig(ctx, tt.uri)
if featureflag.BundleURI.IsEnabled(ctx) {
require.ElementsMatch(t, tt.expected, got)
} else {
require.ElementsMatch(t, []gitcmd.ConfigPair{
{
Key: "uploadpack.advertiseBundleURIs",
Value: "false",
},
}, got)
}
}
}
Loading