pico
created pr with
ps-100
added ps-101
1: 0306c3f < -: ------- chore: rsync test
2: 971b354 ! 1: 745b513 chore: add `rsync --delete` test
added ps-102
1: 745b513 ! 1: 76a6734 chore: add `rsync --delete` test
added ps-103
1: 76a6734 ! 1: 57bb60c chore: add `rsync --delete` test
added ps-104
1: 57bb60c = 1: 57bb60c chore: add `rsync --delete` test
-: ------- > 2: 5c8d929 chore: test is failing on `--delete`
changed status to
accepted
cmds
checkout latest patchset:
ssh pr.pico.sh print pr-47 | git am -3checkout any patchset in a patch request:
ssh pr.pico.sh print ps-X | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 47set PR to open (enables RSS notifications):
ssh pr.pico.sh pr open 47set PR to draft (stops RSS notifications):
ssh pr.pico.sh pr draft 47
Patchset
ps-100
chore: rsync test
Eric Bower
2025-02-17T15:36:03ZSemantic diff summary
3 added,
0 modified,
0 signature changed,
1 removed
across 1 analyzed file
+51
-1
pgs/ssh_test.go
#
@@ -18,7 +18,7 @@ import (
"golang.org/x/crypto/ssh"
)
-func TestSshServer(t *testing.T) {
+func TestSshServerSftp(t *testing.T) {
logger := slog.Default()
dbpool := pgsdb.NewDBMemory(logger)
// setup test data
@@ -57,6 +57,52 @@ func TestSshServer(t *testing.T) {
done <- nil
}
+func TestSshServerRsync(t *testing.T) {
+ logger := slog.Default()
+ dbpool := pgsdb.NewDBMemory(logger)
+ // setup test data
+ dbpool.SetupTestData()
+ st, err := storage.NewStorageMemory(map[string]map[string]string{})
+ if err != nil {
+ panic(err)
+ }
+ cfg := NewPgsConfig(logger, dbpool, st)
+ done := make(chan error)
+ go StartSshServer(cfg, done)
+ // Hack to wait for startup
+ time.Sleep(time.Millisecond * 100)
+
+ user := GenerateUser()
+ // add user's pubkey to the default test account
+ dbpool.Pubkeys = append(dbpool.Pubkeys, &db.PublicKey{
+ ID: "nice-pubkey",
+ UserID: dbpool.Users[0].ID,
+ Key: utils.KeyForKeyText(user.signer.PublicKey()),
+ })
+
+ /* client, err := user.NewClient()
+ if err != nil {
+ t.Error(err)
+ return
+ }
+ defer client.Close()
+
+ _, err = WriteFilesWithRsync(cfg, client, []string{"index.html", "about.html", "favicon.png", "profile.jpg"})
+ if err != nil {
+ t.Error(err)
+ return
+ }
+
+ // test `--delete` functionality
+ _, err = WriteFilesWithRsync(cfg, client, []string{"index.html", "profile.jpg"})
+ if err != nil {
+ t.Error(err)
+ return
+ } */
+
+ done <- nil
+}
+
type UserSSH struct {
username string
signer ssh.Signer
@@ -157,6 +203,10 @@ func GenerateUser() UserSSH {
}
}
+func WriteFilesWithRsync(cfg *PgsConfig, conn *ssh.Client, files []string) (*os.FileInfo, error) {
+ return nil, nil
+}
+
func WriteFileWithSftp(cfg *PgsConfig, conn *ssh.Client) (*os.FileInfo, error) {
// open an SFTP session over an existing ssh connection.
client, err := sftp.NewClient(conn)