2023-01-06 10:53:25 +00:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
2023-01-09 14:55:10 +00:00
|
|
|
"context"
|
2023-01-06 10:53:25 +00:00
|
|
|
"fmt"
|
2023-01-09 14:55:10 +00:00
|
|
|
"io/ioutil"
|
|
|
|
"strings"
|
2023-01-06 10:53:25 +00:00
|
|
|
"testing"
|
|
|
|
|
2023-01-09 14:55:10 +00:00
|
|
|
"github.com/google/go-github/github"
|
2023-01-06 10:53:25 +00:00
|
|
|
)
|
|
|
|
|
2023-01-09 14:55:10 +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
|
|
|
}
|