suppress log messages for tests
This commit is contained in:
parent
1a9a27156b
commit
8566e7c0bd
2 changed files with 7 additions and 2 deletions
|
|
@ -247,6 +247,7 @@
|
||||||
//! decided from the Lot.maturity_date field, not from the file's form.
|
//! decided from the Lot.maturity_date field, not from the file's form.
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const builtin = @import("builtin");
|
||||||
const zfin = @import("../root.zig");
|
const zfin = @import("../root.zig");
|
||||||
const cli = @import("common.zig");
|
const cli = @import("common.zig");
|
||||||
const git = @import("../git.zig");
|
const git = @import("../git.zig");
|
||||||
|
|
@ -732,7 +733,9 @@ fn loadDividendCredits(
|
||||||
for (holdings) |h| {
|
for (holdings) |h| {
|
||||||
if (divs.contains(h.symbol)) continue;
|
if (divs.contains(h.symbol)) continue;
|
||||||
fetchDividendsInto(arena, svc, &divs, h.symbol, fetch_opts) catch |err| {
|
fetchDividendsInto(arena, svc, &divs, h.symbol, fetch_opts) catch |err| {
|
||||||
std.log.scoped(.contributions).warn("{s}: dividends unavailable ({t}); a dividend it paid into {s} will count as a contribution", .{ h.symbol, err, h.account });
|
// The degradation test reaches this on purpose and asserts the
|
||||||
|
// outcome instead.
|
||||||
|
if (!builtin.is_test) std.log.scoped(.contributions).warn("{s}: dividends unavailable ({t}); a dividend it paid into {s} will count as a contribution", .{ h.symbol, err, h.account });
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return dividendCredits(arena, holdings, w, &divs);
|
return dividendCredits(arena, holdings, w, &divs);
|
||||||
|
|
|
||||||
|
|
@ -756,7 +756,9 @@ pub const DataService = struct {
|
||||||
// collapsing it, and do not negative-cache - nothing is
|
// collapsing it, and do not negative-cache - nothing is
|
||||||
// wrong with the symbol.
|
// wrong with the symbol.
|
||||||
if (err == DataError.NoApiKey) {
|
if (err == DataError.NoApiKey) {
|
||||||
log.warn("{s}: {s} unavailable: no API key configured", .{ symbol, @tagName(data_type) });
|
// Tests reach this on purpose - there is no key in the test
|
||||||
|
// environment - and assert the typed error instead.
|
||||||
|
if (!builtin.is_test) log.warn("{s}: {s} unavailable: no API key configured", .{ symbol, @tagName(data_type) });
|
||||||
return DataError.NoApiKey;
|
return DataError.NoApiKey;
|
||||||
}
|
}
|
||||||
// Only NotFound (provider says "this symbol genuinely has
|
// Only NotFound (provider says "this symbol genuinely has
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue