pico

created pr with 47.1 on 2025-02-21T21:07:49Z · by c8ef7d19
added 47.2 on 2025-02-21T21:21:15Z · by c8ef7d19
1: 0306c3f < -: ------- chore: rsync test
2: 971b354 ! 1: 745b513 chore: add `rsync --delete` test
added 47.3 on 2025-02-21T21:21:56Z · by c8ef7d19
1: 745b513 ! 1: 76a6734 chore: add `rsync --delete` test
added 47.4 on 2025-02-21T21:22:20Z · by c8ef7d19
1: 76a6734 ! 1: 57bb60c chore: add `rsync --delete` test
added 47.5 on 2025-02-22T02:12:03Z · by c8ef7d19
1: 57bb60c = 1: 57bb60c chore: add `rsync --delete` test
-: ------- > 2: 5c8d929 chore: test is failing on `--delete`
changed status to accepted on 2025-03-13T14:53:20Z · by c8ef7d19
cmds
checkout latest patchset:
ssh pr.pico.sh print 47 | git am -3
checkout any patchset in a patch request:
ssh pr.pico.sh print 47.[rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 47
set PR to open (enables RSS notifications):
ssh pr.pico.sh pr open 47
set PR to draft (stops RSS notifications):
ssh pr.pico.sh pr draft 47
+51 -1 pgs/ssh_test.go #
......@@ -18,7 +18,7 @@ import (
1818 "golang.org/x/crypto/ssh"
1919 )
2020
21-func TestSshServer(t *testing.T) {
21+func TestSshServerSftp(t *testing.T) {
2222 logger := slog.Default()
2323 dbpool := pgsdb.NewDBMemory(logger)
2424 // setup test data
......@@ -57,6 +57,52 @@ func TestSshServer(t *testing.T) {
5757 done <- nil
5858 }
5959
60+func TestSshServerRsync(t *testing.T) {
61+ logger := slog.Default()
62+ dbpool := pgsdb.NewDBMemory(logger)
63+ // setup test data
64+ dbpool.SetupTestData()
65+ st, err := storage.NewStorageMemory(map[string]map[string]string{})
66+ if err != nil {
67+ panic(err)
68+ }
69+ cfg := NewPgsConfig(logger, dbpool, st)
70+ done := make(chan error)
71+ go StartSshServer(cfg, done)
72+ // Hack to wait for startup
73+ time.Sleep(time.Millisecond * 100)
74+
75+ user := GenerateUser()
76+ // add user's pubkey to the default test account
77+ dbpool.Pubkeys = append(dbpool.Pubkeys, &db.PublicKey{
78+ ID: "nice-pubkey",
79+ UserID: dbpool.Users[0].ID,
80+ Key: utils.KeyForKeyText(user.signer.PublicKey()),
81+ })
82+
83+ /* client, err := user.NewClient()
84+ if err != nil {
85+ t.Error(err)
86+ return
87+ }
88+ defer client.Close()
89+
90+ _, err = WriteFilesWithRsync(cfg, client, []string{"index.html", "about.html", "favicon.png", "profile.jpg"})
91+ if err != nil {
92+ t.Error(err)
93+ return
94+ }
95+
96+ // test `--delete` functionality
97+ _, err = WriteFilesWithRsync(cfg, client, []string{"index.html", "profile.jpg"})
98+ if err != nil {
99+ t.Error(err)
100+ return
101+ } */
102+
103+ done <- nil
104+}
105+
60106 type UserSSH struct {
61107 username string
62108 signer ssh.Signer
......@@ -157,6 +203,10 @@ func GenerateUser() UserSSH {
157203 }
158204 }
159205
206+func WriteFilesWithRsync(cfg *PgsConfig, conn *ssh.Client, files []string) (*os.FileInfo, error) {
207+ return nil, nil
208+}
209+
160210 func WriteFileWithSftp(cfg *PgsConfig, conn *ssh.Client) (*os.FileInfo, error) {
161211 // open an SFTP session over an existing ssh connection.
162212 client, err := sftp.NewClient(conn)
Back to top