mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-10-22 14:23:00 +00:00
This commit makes change to the code, scripts and some template files to reflect the change of the org after donation to CNCF. The files under "/site" "/changelogs" and "/design" are deliberately excluded in this change. I'll make follow up changes in these directories when needed. Signed-off-by: Daniel Jiang <daniel.jiang@broadcom.com>
64 lines
1.8 KiB
Go
Executable File
64 lines
1.8 KiB
Go
Executable File
/*
|
|
Copyright the Velero contributors.
|
|
|
|
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 bug
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/velero-io/velero/pkg/buildinfo"
|
|
)
|
|
|
|
func TestNewCommand(t *testing.T) {
|
|
cmd := NewCommand()
|
|
require.NotNil(t, cmd)
|
|
require.Equal(t, "bug", cmd.Use)
|
|
require.Equal(t, "Report a Velero bug", cmd.Short)
|
|
}
|
|
|
|
func TestNewBugInfo(t *testing.T) {
|
|
origVersion := buildinfo.Version
|
|
buildinfo.Version = "v1.18.0"
|
|
defer func() { buildinfo.Version = origVersion }()
|
|
|
|
info := newBugInfo("v1.30.0")
|
|
require.NotNil(t, info)
|
|
require.Equal(t, "v1.30.0", info.KubectlVersion)
|
|
require.Equal(t, "v1.18.0", info.VeleroVersion)
|
|
require.NotEmpty(t, info.RuntimeOS)
|
|
require.NotEmpty(t, info.RuntimeArch)
|
|
}
|
|
|
|
func TestRenderToString(t *testing.T) {
|
|
info := newBugInfo("v1.30.0")
|
|
rendered, err := renderToString(info)
|
|
require.NoError(t, err)
|
|
require.NotEmpty(t, rendered)
|
|
|
|
// Verify template includes updated repository URLs
|
|
require.Contains(t, rendered, "https://github.com/velero-io/velero/issues")
|
|
require.NotContains(t, rendered, "https://github.com/vmware-tanzu/velero/issues")
|
|
require.Contains(t, rendered, "v1.30.0")
|
|
}
|
|
|
|
func TestIssueURL(t *testing.T) {
|
|
require.True(t, strings.HasPrefix(issueURL, "https://github.com/velero-io/velero/issues/new"))
|
|
require.NotContains(t, issueURL, "vmware-tanzu")
|
|
}
|