blob: ef86672fc387715f23134ad4764d7850a7dd198c [file] [edit]
// Copyright 2022 Google LLC
//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package ramdisk
import (
"context"
"os"
"testing"
"github.com/stretchr/testify/require"
)
func TestRamDisk(t *testing.T) {
// Create a ram disk. Ensure that it creates a real directory.
rd, cleanup, err := New(context.Background())
require.NoError(t, err)
st, err := os.Stat(rd)
require.NoError(t, err)
require.True(t, st.IsDir())
// Remove the ram disk. Ensure that it no longer exists.
cleanup()
_, err = os.Stat(rd)
require.True(t, os.IsNotExist(err))
}