@@ -59,8 +59,8 @@ func TestCreateAndDeleteWorkspaceFromWorkspace(t *testing.T) {
59
59
t .Fatalf ("Error reading file: %v" , err )
60
60
}
61
61
62
- if ! bytes .Equal (content . Content , []byte ("hello world" )) {
63
- t .Errorf ("Unexpected content: %s" , content . Content )
62
+ if ! bytes .Equal (content , []byte ("hello world" )) {
63
+ t .Errorf ("Unexpected content: %s" , content )
64
64
}
65
65
66
66
err = g .DeleteWorkspace (context .Background (), id )
@@ -92,26 +92,22 @@ func TestWriteReadAndDeleteFileFromWorkspace(t *testing.T) {
92
92
t .Errorf ("Error reading file: %v" , err )
93
93
}
94
94
95
- if ! bytes .Equal (content .Content , []byte ("test" )) {
96
- t .Errorf ("Unexpected content: %s" , content .Content )
97
- }
98
-
99
- if content .RevisionID != "" {
100
- t .Errorf ("Unexpected file revision ID when not requesting it: %s" , content .RevisionID )
95
+ if ! bytes .Equal (content , []byte ("test" )) {
96
+ t .Errorf ("Unexpected content: %s" , content )
101
97
}
102
98
103
99
// Read the file and request the revision ID
104
- content , err = g .ReadFileInWorkspace (context .Background (), "test.txt" , ReadFileInWorkspaceOptions {WorkspaceID : id , WithLatestRevisionID : true })
100
+ contentWithRevision , err : = g .ReadFileWithRevisionInWorkspace (context .Background (), "test.txt" , ReadFileInWorkspaceOptions {WorkspaceID : id })
105
101
if err != nil {
106
102
t .Errorf ("Error reading file: %v" , err )
107
103
}
108
104
109
- if ! bytes .Equal (content .Content , []byte ("test" )) {
110
- t .Errorf ("Unexpected content: %s" , content .Content )
105
+ if ! bytes .Equal (contentWithRevision .Content , []byte ("test" )) {
106
+ t .Errorf ("Unexpected content: %s" , contentWithRevision .Content )
111
107
}
112
108
113
- if content .RevisionID == "" {
114
- t .Errorf ("Expected file revision ID when requesting it: %s" , content .RevisionID )
109
+ if contentWithRevision .RevisionID == "" {
110
+ t .Errorf ("Expected file revision ID when requesting it: %s" , contentWithRevision .RevisionID )
115
111
}
116
112
117
113
// Stat the file to ensure it exists
@@ -553,8 +549,8 @@ func TestCreateAndDeleteWorkspaceFromWorkspaceS3(t *testing.T) {
553
549
t .Errorf ("Error reading file: %v" , err )
554
550
}
555
551
556
- if ! bytes .Equal (content . Content , []byte ("hello world" )) {
557
- t .Errorf ("Unexpected content: %s" , content . Content )
552
+ if ! bytes .Equal (content , []byte ("hello world" )) {
553
+ t .Errorf ("Unexpected content: %s" , content )
558
554
}
559
555
560
556
err = g .DeleteWorkspace (context .Background (), id )
@@ -597,8 +593,8 @@ func TestCreateAndDeleteDirectoryWorkspaceFromWorkspaceS3(t *testing.T) {
597
593
t .Errorf ("Error reading file: %v" , err )
598
594
}
599
595
600
- if ! bytes .Equal (content . Content , []byte ("hello world" )) {
601
- t .Errorf ("Unexpected content: %s" , content . Content )
596
+ if ! bytes .Equal (content , []byte ("hello world" )) {
597
+ t .Errorf ("Unexpected content: %s" , content )
602
598
}
603
599
604
600
err = g .DeleteWorkspace (context .Background (), id )
@@ -648,8 +644,8 @@ func TestCreateAndDeleteS3WorkspaceFromWorkspaceDirectory(t *testing.T) {
648
644
t .Fatalf ("Error reading file: %v" , err )
649
645
}
650
646
651
- if ! bytes .Equal (content . Content , []byte ("hello world" )) {
652
- t .Errorf ("Unexpected content: %s" , content . Content )
647
+ if ! bytes .Equal (content , []byte ("hello world" )) {
648
+ t .Errorf ("Unexpected content: %s" , content )
653
649
}
654
650
655
651
err = g .DeleteWorkspace (context .Background (), id )
@@ -685,26 +681,22 @@ func TestWriteReadAndDeleteFileFromWorkspaceS3(t *testing.T) {
685
681
t .Errorf ("Error reading file: %v" , err )
686
682
}
687
683
688
- if ! bytes .Equal (content .Content , []byte ("test" )) {
689
- t .Errorf ("Unexpected content: %s" , content .Content )
690
- }
691
-
692
- if content .RevisionID != "" {
693
- t .Errorf ("Unexpected file revision ID when not requesting it: %s" , content .RevisionID )
684
+ if ! bytes .Equal (content , []byte ("test" )) {
685
+ t .Errorf ("Unexpected content: %s" , content )
694
686
}
695
687
696
688
// Read the file and request the revision ID
697
- content , err = g .ReadFileInWorkspace (context .Background (), "test.txt" , ReadFileInWorkspaceOptions {WorkspaceID : id , WithLatestRevisionID : true })
689
+ contentWithRevision , err : = g .ReadFileWithRevisionInWorkspace (context .Background (), "test.txt" , ReadFileInWorkspaceOptions {WorkspaceID : id })
698
690
if err != nil {
699
691
t .Errorf ("Error reading file: %v" , err )
700
692
}
701
693
702
- if ! bytes .Equal (content .Content , []byte ("test" )) {
703
- t .Errorf ("Unexpected content: %s" , content .Content )
694
+ if ! bytes .Equal (contentWithRevision .Content , []byte ("test" )) {
695
+ t .Errorf ("Unexpected content: %s" , contentWithRevision .Content )
704
696
}
705
697
706
- if content .RevisionID == "" {
707
- t .Errorf ("Expected file revision ID when requesting it: %s" , content .RevisionID )
698
+ if contentWithRevision .RevisionID == "" {
699
+ t .Errorf ("Expected file revision ID when requesting it: %s" , contentWithRevision .RevisionID )
708
700
}
709
701
710
702
// Stat the file to ensure it exists
0 commit comments