Skip to content

Commit 8c6a86f

Browse files
committed
Client::from_database shouldn't try to update
In order to create a `tuf::Database`, it needs to have been initialized with a root metadata, so we don't need to force the client to do an update.
1 parent f0f30d9 commit 8c6a86f

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

tuf/src/client.rs

+9-18
Original file line numberDiff line numberDiff line change
@@ -332,14 +332,13 @@ where
332332
}
333333

334334
/// Create a new TUF client. It will trust and update the TUF database.
335-
pub async fn from_database(
336-
config: Config,
337-
tuf: Database<D>,
338-
local: L,
339-
remote: R,
340-
) -> Result<Self> {
341-
let (local, remote) = (Repository::new(local), Repository::new(remote));
342-
Self::new(config, tuf, local, remote).await
335+
pub fn from_database(config: Config, tuf: Database<D>, local: L, remote: R) -> Self {
336+
Self {
337+
config,
338+
tuf,
339+
local: Repository::new(local),
340+
remote: Repository::new(remote),
341+
}
343342
}
344343

345344
/// Construct a client with the given parts.
@@ -1499,9 +1498,7 @@ mod test {
14991498
Database::from_trusted_root(metadata1.root().unwrap()).unwrap(),
15001499
track_local,
15011500
track_remote,
1502-
)
1503-
.await
1504-
.unwrap(),
1501+
),
15051502
};
15061503

15071504
assert_eq!(client.tuf.trusted_root().version(), 1);
@@ -1546,13 +1543,7 @@ mod test {
15461543
);
15471544
}
15481545
ConstructorMode::FromDatabase => {
1549-
assert_eq!(
1550-
client.local_repo().take_tracks(),
1551-
vec![Track::FetchErr(
1552-
MetadataPath::root(),
1553-
MetadataVersion::Number(2)
1554-
)],
1555-
);
1546+
assert_eq!(client.local_repo().take_tracks(), vec![],);
15561547
}
15571548
};
15581549

0 commit comments

Comments
 (0)