Skip to content

Commit df4240b

Browse files
authored
fix(extensions): clear processors logging (#1222)
* Update log messages Signed-off-by: Dominika Zemanovicova <dzemanov@redhat.com> * Switch to debug for now Signed-off-by: Dominika Zemanovicova <dzemanov@redhat.com> --------- Signed-off-by: Dominika Zemanovicova <dzemanov@redhat.com>
1 parent c24a7e9 commit df4240b

6 files changed

Lines changed: 28 additions & 20 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-catalog-backend-module-marketplace': patch
3+
---
4+
5+
Clear processors log messages

workspaces/marketplace/plugins/catalog-backend-module-marketplace/src/processors/DynamicPackageInstallStatusProcessor.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ describe('DynamicPackageInstallStatusProcessor', () => {
114114
);
115115

116116
expect(entity.spec?.installStatus).toBe(undefined);
117-
expect(logger.warn).toHaveBeenCalledWith(
118-
"Entity package:default/testpackage is missing spec.packageName, unable to determine 'spec.installStatus'",
117+
expect(logger.debug).toHaveBeenCalledWith(
118+
"Entity package:default/testpackage is missing 'spec.packageName', unable to determine 'spec.installStatus'",
119119
);
120120
});
121121

@@ -199,8 +199,8 @@ describe('DynamicPackageInstallStatusProcessor', () => {
199199
cache,
200200
);
201201
expect(result.spec?.installStatus).toBe(undefined);
202-
expect(logger.warn).toHaveBeenCalledWith(
203-
"Missing 'entity.spec.dynamicArtifact', unable to determine 'spec.installStatus'",
202+
expect(logger.debug).toHaveBeenCalledWith(
203+
"Entity package:default/testpackage is missing 'spec.dynamicArtifact', unable to determine 'spec.installStatus'",
204204
);
205205
});
206206

workspaces/marketplace/plugins/catalog-backend-module-marketplace/src/processors/DynamicPackageInstallStatusProcessor.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ export class DynamicPackageInstallStatusProcessor implements CatalogProcessor {
104104
installedPackages: Plugins,
105105
): MarketplacePackageInstallStatus | undefined {
106106
if (!marketplacePackage.spec?.packageName) {
107-
this.logger.warn(
108-
"Missing 'entity.spec.packageName', unable to determine 'spec.installStatus'",
107+
this.logger.debug(
108+
`Entity ${stringifyEntityRef(marketplacePackage)} is missing 'spec.packageName', unable to determine 'spec.installStatus'`,
109109
);
110110
return undefined;
111111
}
@@ -133,8 +133,8 @@ export class DynamicPackageInstallStatusProcessor implements CatalogProcessor {
133133
}
134134

135135
if (!marketplacePackage.spec?.dynamicArtifact) {
136-
this.logger.warn(
137-
"Missing 'entity.spec.dynamicArtifact', unable to determine 'spec.installStatus'",
136+
this.logger.debug(
137+
`Entity ${stringifyEntityRef(marketplacePackage)} is missing 'spec.dynamicArtifact', unable to determine 'spec.installStatus'`,
138138
);
139139
return undefined;
140140
}
@@ -155,8 +155,8 @@ export class DynamicPackageInstallStatusProcessor implements CatalogProcessor {
155155
): Promise<Entity> {
156156
if (isMarketplacePackage(entity)) {
157157
if (!entity.spec?.packageName) {
158-
this.logger.warn(
159-
`Entity ${stringifyEntityRef(entity)} is missing spec.packageName, unable to determine 'spec.installStatus'`,
158+
this.logger.debug(
159+
`Entity ${stringifyEntityRef(entity)} is missing 'spec.packageName', unable to determine 'spec.installStatus'`,
160160
);
161161
return entity;
162162
}

workspaces/marketplace/plugins/catalog-backend-module-marketplace/src/processors/LocalPackageInstallStatusProcessor.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ export class LocalPackageInstallStatusProcessor implements CatalogProcessor {
120120

121121
return null;
122122
} catch (error) {
123-
console.warn('xxx', error);
123+
console.warn(
124+
`Error occurred while processing local install status of ${packageName}`,
125+
error,
126+
);
124127
return null;
125128
}
126129
}

workspaces/marketplace/plugins/catalog-backend-module-marketplace/src/processors/PluginInstallStatusProcessor.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ describe('PluginInstallStatusProcessor', () => {
181181
);
182182

183183
expect(entity.spec?.installStatus).toBe(undefined);
184-
expect(logger.warn).toHaveBeenCalledWith(
184+
expect(logger.debug).toHaveBeenCalledWith(
185185
"Entity plugin:default/plugin1 is missing packages, unable to determine 'spec.installStatus'",
186186
);
187187
});
@@ -290,8 +290,8 @@ describe('PluginInstallStatusProcessor', () => {
290290
);
291291

292292
expect(entity.spec?.installStatus).toBe(undefined);
293-
expect(logger.warn).toHaveBeenCalledWith(
294-
"Missing all definitions for plugin:marketplace-plugin-demo/marketplace packages installStatus, unable to determine 'spec.installStatus'",
293+
expect(logger.debug).toHaveBeenCalledWith(
294+
"Entity plugin:marketplace-plugin-demo/marketplace is missing all definitions of 'spec.installStatus' in its packages, unable to determine 'spec.installStatus'",
295295
);
296296
});
297297

@@ -314,8 +314,8 @@ describe('PluginInstallStatusProcessor', () => {
314314
);
315315

316316
expect(entity.spec?.installStatus).toBe(undefined);
317-
expect(logger.warn).toHaveBeenCalledWith(
318-
"Missing all definitions for plugin:marketplace-plugin-demo/marketplace packages installStatus, unable to determine 'spec.installStatus'",
317+
expect(logger.debug).toHaveBeenCalledWith(
318+
"Entity plugin:marketplace-plugin-demo/marketplace is missing all definitions of 'spec.installStatus' in its packages, unable to determine 'spec.installStatus'",
319319
);
320320
});
321321

workspaces/marketplace/plugins/catalog-backend-module-marketplace/src/processors/PluginInstallStatusProcessor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export class PluginInstallStatusProcessor implements CatalogProcessor {
196196
);
197197

198198
if (!pluginPackageRefs || pluginPackageRefs.length === 0) {
199-
this.logger.warn(
199+
this.logger.debug(
200200
`Entity ${stringifyEntityRef(marketplacePlugin)} is missing 'spec.packages', unable to determine 'spec.installStatus'`,
201201
);
202202
return undefined;
@@ -205,8 +205,8 @@ export class PluginInstallStatusProcessor implements CatalogProcessor {
205205
const pluginPackageStatuses =
206206
await this.getPluginPackageInstallStatuses(pluginPackageRefs);
207207
if (pluginPackageRefs.length !== pluginPackageStatuses.length) {
208-
this.logger.warn(
209-
`Missing all definitions for ${stringifyEntityRef(marketplacePlugin)} packages installStatus, unable to determine 'spec.installStatus'`,
208+
this.logger.debug(
209+
`Entity ${stringifyEntityRef(marketplacePlugin)} is missing all definitions of 'spec.installStatus' in its packages, unable to determine 'spec.installStatus'`,
210210
);
211211
return undefined;
212212
}
@@ -261,7 +261,7 @@ export class PluginInstallStatusProcessor implements CatalogProcessor {
261261
): Promise<Entity> {
262262
if (isMarketplacePlugin(entity)) {
263263
if (!entity.spec?.packages || entity.spec.packages.length === 0) {
264-
this.logger.warn(
264+
this.logger.debug(
265265
`Entity ${stringifyEntityRef(entity)} is missing packages, unable to determine 'spec.installStatus'`,
266266
);
267267
return entity;

0 commit comments

Comments
 (0)