pico

created pr with ps-100 on 2025-02-21T21:07:49Z · by c8ef7d19
added ps-101 on 2025-02-21T21:21:15Z · by c8ef7d19
1: 0306c3f < -: ------- chore: rsync test
2: 971b354 ! 1: 745b513 chore: add `rsync --delete` test
added ps-102 on 2025-02-21T21:21:56Z · by c8ef7d19
1: 745b513 ! 1: 76a6734 chore: add `rsync --delete` test
added ps-103 on 2025-02-21T21:22:20Z · by c8ef7d19
1: 76a6734 ! 1: 57bb60c chore: add `rsync --delete` test
added ps-104 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 pr-47 | git am -3
checkout any patchset in a patch request:
ssh pr.pico.sh print ps-X | 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 (
 	"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)
Back to top