@@ -114,6 +114,58 @@ func TestIndexStorage_MarkArchived(t *testing.T) {
114114 assert .Equal (t , SpaceStatusArchived , status )
115115}
116116
117+ func TestIndexStorage_SpaceStatusEntry (t * testing.T ) {
118+ t .Run ("not found" , func (t * testing.T ) {
119+ tempDir := t .TempDir ()
120+ fx , err := createTestIndexStorage (ctx , tempDir )
121+ require .NoError (t , err )
122+ defer fx .Close ()
123+
124+ _ , err = fx .(* indexStorage ).SpaceStatusEntry (ctx , "nonexistent" )
125+ require .ErrorIs (t , err , anystore .ErrDocNotFound )
126+ })
127+
128+ t .Run ("existing entry" , func (t * testing.T ) {
129+ tempDir := t .TempDir ()
130+ fx , err := createTestIndexStorage (ctx , tempDir )
131+ require .NoError (t , err )
132+ defer fx .Close ()
133+
134+ require .NoError (t , fx .SetSpaceStatus (ctx , "space1" , SpaceStatusOk , "" ))
135+ require .NoError (t , fx .UpdateHash (ctx , SpaceUpdate {
136+ SpaceId : "space1" ,
137+ OldHash : "old" ,
138+ NewHash : "new" ,
139+ }))
140+ require .NoError (t , fx .MarkArchived (ctx , "space1" , 100 , 200 ))
141+
142+ entry , err := fx .(* indexStorage ).SpaceStatusEntry (ctx , "space1" )
143+ require .NoError (t , err )
144+ assert .Equal (t , "space1" , entry .SpaceId )
145+ assert .Equal (t , SpaceStatusArchived , entry .Status )
146+ assert .Equal (t , "new" , entry .NewHash )
147+ assert .Equal (t , "old" , entry .OldHash )
148+ assert .Equal (t , int64 (100 ), entry .ArchiveSizeCompressed )
149+ assert .Equal (t , int64 (200 ), entry .ArchiveSizeUncompressed )
150+ assert .False (t , entry .LastAccess .IsZero ())
151+ })
152+
153+ t .Run ("error status" , func (t * testing.T ) {
154+ tempDir := t .TempDir ()
155+ fx , err := createTestIndexStorage (ctx , tempDir )
156+ require .NoError (t , err )
157+ defer fx .Close ()
158+
159+ require .NoError (t , fx .SetSpaceStatus (ctx , "space1" , SpaceStatusOk , "" ))
160+ require .NoError (t , fx .MarkError (ctx , "space1" , "some error" ))
161+
162+ entry , err := fx .(* indexStorage ).SpaceStatusEntry (ctx , "space1" )
163+ require .NoError (t , err )
164+ assert .Equal (t , SpaceStatusError , entry .Status )
165+ assert .Equal (t , "some error" , entry .Error )
166+ })
167+ }
168+
117169func TestIndexStorage_MarkError (t * testing.T ) {
118170 tempDir := t .TempDir ()
119171 fx , err := createTestIndexStorage (ctx , tempDir )
0 commit comments