1Panel/backend/app/service/snapshot_test.go

44 lines
1.1 KiB
Go
Raw Normal View History

2023-01-06 10:53:25 +00:00
package service
import (
"context"
2023-01-06 10:53:25 +00:00
"fmt"
"io/ioutil"
"strings"
2023-01-06 10:53:25 +00:00
"testing"
"github.com/google/go-github/github"
2023-01-06 10:53:25 +00:00
)
func TestDi(t *testing.T) {
docker := "var/lib/docker"
fmt.Println(docker[strings.LastIndex(docker, "/"):])
fmt.Println(docker[:strings.LastIndex(docker, "/")])
}
func TestGit(t *testing.T) {
client := github.NewClient(nil)
stats, _, err := client.Repositories.GetLatestRelease(context.Background(), "KubeOperator", "KubeOperator")
fmt.Println(github.Timestamp(*stats.PublishedAt), err)
}
func TestSdasd(t *testing.T) {
u := NewISnapshotService()
var snapjson SnapshotJson
snapjson, _ = u.readFromJson("/Users/slooop/Downloads/snapshot.json")
fmt.Println(111, snapjson)
// if err := ioutil.WriteFile("/Users/slooop/Downloads/snapshot.json", []byte("111xxxxx"), 0640); err != nil {
// fmt.Println(err)
// }
}
func TestCp(t *testing.T) {
_, err := ioutil.ReadFile("/Users/slooop/Downloads/test/main")
if err != nil {
fmt.Println(err)
}
if err := ioutil.WriteFile("/Users/slooop/Downloads/test/main", []byte("sdadasd"), 0640); err != nil {
fmt.Println(err)
}
2023-01-06 10:53:25 +00:00
}