2023-04-10 15:36:59 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2019-03-29 18:47:40 +00:00
|
|
|
package apitests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-03-15 12:42:43 +00:00
|
|
|
"github.com/hashicorp/nomad/ci"
|
2019-03-29 18:47:40 +00:00
|
|
|
"github.com/hashicorp/nomad/helper/uuid"
|
|
|
|
"github.com/hashicorp/nomad/nomad/structs"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNodes_GC(t *testing.T) {
|
2022-03-15 12:42:43 +00:00
|
|
|
ci.Parallel(t)
|
2019-03-29 18:47:40 +00:00
|
|
|
require := require.New(t)
|
|
|
|
c, s := makeClient(t, nil, nil)
|
|
|
|
defer s.Stop()
|
|
|
|
nodes := c.Nodes()
|
|
|
|
|
|
|
|
err := nodes.GC(uuid.Generate(), nil)
|
|
|
|
require.NotNil(err)
|
|
|
|
require.True(structs.IsErrUnknownNode(err))
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestNodes_GcAlloc(t *testing.T) {
|
2022-03-15 12:42:43 +00:00
|
|
|
ci.Parallel(t)
|
2019-03-29 18:47:40 +00:00
|
|
|
require := require.New(t)
|
|
|
|
c, s := makeClient(t, nil, nil)
|
|
|
|
defer s.Stop()
|
|
|
|
nodes := c.Nodes()
|
|
|
|
|
|
|
|
err := nodes.GcAlloc(uuid.Generate(), nil)
|
|
|
|
require.NotNil(err)
|
|
|
|
require.True(structs.IsErrUnknownAllocation(err))
|
|
|
|
}
|