mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Deprecate FolderID in libraryElement struct in tests (#77473)
* Chore: Deprecate FolderID in LibraryElement struct in tests * chore: revert formatting for deprecation comment
This commit is contained in:
parent
2c7f364067
commit
911ffed45b
@ -26,7 +26,7 @@ func TestCreateLibraryElement(t *testing.T) {
|
||||
Result: libraryElement{
|
||||
ID: 1,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: sc.initialResult.Result.UID,
|
||||
Name: "Text - Library Panel",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -75,7 +75,7 @@ func TestCreateLibraryElement(t *testing.T) {
|
||||
Result: libraryElement{
|
||||
ID: 1,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: command.UID,
|
||||
Name: "Nonexistent UID",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -150,7 +150,7 @@ func TestCreateLibraryElement(t *testing.T) {
|
||||
Result: libraryElement{
|
||||
ID: 1,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.UID,
|
||||
Name: "Library Panel Name",
|
||||
Kind: int64(model.PanelElement),
|
||||
|
@ -62,7 +62,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 1,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.Elements[0].UID,
|
||||
Name: "Text - Library Panel",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -128,7 +128,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 2,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.Elements[0].UID,
|
||||
Name: "query0",
|
||||
Kind: int64(model.VariableElement),
|
||||
@ -189,7 +189,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 1,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.Elements[0].UID,
|
||||
Name: "Text - Library Panel",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -224,7 +224,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 2,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.Elements[1].UID,
|
||||
Name: "Text - Library Panel2",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -289,7 +289,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 2,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.Elements[0].UID,
|
||||
Name: "Text - Library Panel2",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -324,7 +324,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 1,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.Elements[1].UID,
|
||||
Name: "Text - Library Panel",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -410,7 +410,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 3,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.Elements[0].UID,
|
||||
Name: "BarGauge - Library Panel",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -445,7 +445,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 2,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.Elements[1].UID,
|
||||
Name: "Gauge - Library Panel",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -549,7 +549,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 2,
|
||||
OrgID: 1,
|
||||
FolderID: newFolder.ID,
|
||||
FolderID: newFolder.ID, // nolint:staticcheck
|
||||
UID: result.Result.Elements[0].UID,
|
||||
Name: "Text - Library Panel2",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -646,7 +646,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 1,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.Elements[0].UID,
|
||||
Name: "Text - Library Panel",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -681,7 +681,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 2,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.Elements[1].UID,
|
||||
Name: "Text - Library Panel2",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -746,7 +746,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 2,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.Elements[0].UID,
|
||||
Name: "Text - Library Panel2",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -811,7 +811,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 1,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.Elements[0].UID,
|
||||
Name: "Text - Library Panel",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -877,7 +877,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 2,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.Elements[0].UID,
|
||||
Name: "Text - Library Panel2",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -952,7 +952,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 1,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.Elements[0].UID,
|
||||
Name: "Text - Library Panel",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -1025,7 +1025,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 2,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.Elements[0].UID,
|
||||
Name: "Some Other",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -1060,7 +1060,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 1,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.Elements[1].UID,
|
||||
Name: "Text - Library Panel",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -1127,7 +1127,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
{
|
||||
ID: 2,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: result.Result.Elements[0].UID,
|
||||
Name: "Text - Library Panel2",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -1238,6 +1238,7 @@ func TestGetAllLibraryElements(t *testing.T) {
|
||||
err := json.Unmarshal(resp.Body(), &result)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(result.Result.Elements))
|
||||
// nolint:staticcheck
|
||||
require.Equal(t, int64(1), result.Result.Elements[0].FolderID)
|
||||
require.Equal(t, "Text - Library Panel", result.Result.Elements[0].Name)
|
||||
|
||||
|
@ -34,7 +34,7 @@ func TestGetLibraryElement(t *testing.T) {
|
||||
Result: libraryElement{
|
||||
ID: 1,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: res.Result.UID,
|
||||
Name: "Text - Library Panel",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -131,7 +131,7 @@ func TestGetLibraryElement(t *testing.T) {
|
||||
Result: libraryElement{
|
||||
ID: 1,
|
||||
OrgID: 1,
|
||||
FolderID: 1,
|
||||
FolderID: 1, // nolint:staticcheck
|
||||
UID: res.Result.UID,
|
||||
Name: "Text - Library Panel",
|
||||
Kind: int64(model.PanelElement),
|
||||
|
@ -49,7 +49,7 @@ func TestPatchLibraryElement(t *testing.T) {
|
||||
Result: libraryElement{
|
||||
ID: 1,
|
||||
OrgID: 1,
|
||||
FolderID: newFolder.ID,
|
||||
FolderID: newFolder.ID, // nolint:staticcheck
|
||||
UID: sc.initialResult.Result.UID,
|
||||
Name: "Panel - New name",
|
||||
Kind: int64(model.PanelElement),
|
||||
@ -100,6 +100,7 @@ func TestPatchLibraryElement(t *testing.T) {
|
||||
resp := sc.service.patchHandler(sc.reqContext)
|
||||
require.Equal(t, 200, resp.Status())
|
||||
var result = validateAndUnMarshalResponse(t, resp)
|
||||
// nolint:staticcheck
|
||||
sc.initialResult.Result.FolderID = newFolder.ID
|
||||
sc.initialResult.Result.Meta.CreatedBy.Name = userInDbName
|
||||
sc.initialResult.Result.Meta.CreatedBy.AvatarUrl = userInDbAvatar
|
||||
|
@ -191,8 +191,9 @@ func TestGetLibraryPanelConnections(t *testing.T) {
|
||||
}
|
||||
|
||||
type libraryElement struct {
|
||||
ID int64 `json:"id"`
|
||||
OrgID int64 `json:"orgId"`
|
||||
ID int64 `json:"id"`
|
||||
OrgID int64 `json:"orgId"`
|
||||
// Deprecated: use FolderUID instead
|
||||
FolderID int64 `json:"folderId"`
|
||||
UID string `json:"uid"`
|
||||
Name string `json:"name"`
|
||||
|
Loading…
Reference in New Issue
Block a user