Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Deprecated ioutil package #280

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions deploy/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"fmt"
"io"
"io/fs"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -806,7 +805,7 @@ func TestDeployProcess_InstallK3s(t *testing.T) {
osOpenFile = func(name string, _ int, _ os.FileMode) (*os.File, error) {
var err error
// openedFile, err = os.Create(filepath.Join(os.TempDir(), filepath.Base(name)))
openedFile, err = ioutil.TempFile(os.TempDir(), "")
openedFile, err = os.CreateTemp(os.TempDir(), "")
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -873,7 +872,7 @@ func TestDeployProcess_InstallK3s(t *testing.T) {
osOpenFile = func(_ string, _ int, _ os.FileMode) (*os.File, error) {
var err error
// openedFile, err = os.Create(filepath.Join(os.TempDir(), filepath.Base(name)))
openedFile, err = ioutil.TempFile(os.TempDir(), "")
openedFile, err = os.CreateTemp(os.TempDir(), "")
if err != nil {
t.Fatal(err)
}
Expand Down
8 changes: 4 additions & 4 deletions internal/powerflex/token_getter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ package powerflex_test
import (
"context"
"fmt"
"io/ioutil"
"karavi-authorization/internal/powerflex"
"net/http"
"net/http/httptest"
"os"
"testing"
"time"

Expand All @@ -32,7 +32,7 @@ import (
func TestLogin_GetToken(t *testing.T) {
t.Run("success getting a token", func(t *testing.T) {
tokens := make(map[string]interface{})
credFile, err := ioutil.ReadFile("../../tokens.yaml")
credFile, err := os.ReadFile("../../tokens.yaml")
if err != nil {
t.Errorf("unable to read token: %v", err)
}
Expand Down Expand Up @@ -99,7 +99,7 @@ func TestLogin_GetToken(t *testing.T) {

t.Run("success getting a token during refresh", func(t *testing.T) {
tokens := make(map[string]interface{})
credFile, err := ioutil.ReadFile("../../tokens.yaml")
credFile, err := os.ReadFile("../../tokens.yaml")
if err != nil {
t.Errorf("unable to read token: %v", err)
}
Expand Down Expand Up @@ -182,7 +182,7 @@ func TestLogin_GetToken(t *testing.T) {

t.Run("timeout getting a token during refresh", func(t *testing.T) {
tokens := make(map[string]interface{})
credFile, err := ioutil.ReadFile("../../tokens.yaml")
credFile, err := os.ReadFile("../../tokens.yaml")
if err != nil {
t.Errorf("unable to read token: %v", err)
}
Expand Down
3 changes: 1 addition & 2 deletions internal/tenantsvc/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"context"
"encoding/base64"
"fmt"
"io/ioutil"
"karavi-authorization/internal/tenantsvc"
"karavi-authorization/internal/token/jwx"
"karavi-authorization/pb"
Expand Down Expand Up @@ -394,7 +393,7 @@ func testGenerateToken(sut *tenantsvc.TenantService, _ *redis.Client, afterFn Af
func testRefreshToken(sut *tenantsvc.TenantService, _ *redis.Client, afterFn AfterFunc) func(*testing.T) {
return func(t *testing.T) {
tokens := make(map[string]interface{})
credFile, err := ioutil.ReadFile("../../tokens.yaml")
credFile, err := os.ReadFile("../../tokens.yaml")
if err != nil {
t.Errorf("unable to read token: %v", err)
}
Expand Down
6 changes: 3 additions & 3 deletions internal/web/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ package web_test
import (
"context"
"errors"
"io/ioutil"
"karavi-authorization/internal/token/jwx"
"karavi-authorization/internal/web"
"karavi-authorization/pb"
"net/http"
"net/http/httptest"
"os"
"testing"

"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -122,7 +122,7 @@ func TestAuthMW(t *testing.T) {

// test token
tokens := make(map[string]interface{})
credFile, err := ioutil.ReadFile("../../tokens.yaml")
credFile, err := os.ReadFile("../../tokens.yaml")
if err != nil {
t.Errorf("unable to read token: %v", err)
}
Expand All @@ -149,7 +149,7 @@ func TestAuthMW(t *testing.T) {

// test token
tokens := make(map[string]interface{})
credFile, err := ioutil.ReadFile("../../tokens.yaml")
credFile, err := os.ReadFile("../../tokens.yaml")
if err != nil {
t.Errorf("unable to read token: %v", err)
}
Expand Down
Loading