Skip to content

Commit

Permalink
AIP-84 Fix dag reports tests outside of breeze (#46125)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrejeambrun authored Jan 27, 2025
1 parent 261388c commit 9285cc7
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 32 deletions.
4 changes: 2 additions & 2 deletions airflow/api_fastapi/core_api/openapi/v1-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2590,9 +2590,9 @@ paths:
get:
tags:
- DagReport
summary: Get Dag Report
summary: Get Dag Reports
description: Get DAG report.
operationId: get_dag_report
operationId: get_dag_reports
parameters:
- name: subdir
in: query
Expand Down
2 changes: 1 addition & 1 deletion airflow/api_fastapi/core_api/routes/public/dag_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
]
),
)
def get_dag_report(
def get_dag_reports(
subdir: str,
):
"""Get DAG report."""
Expand Down
14 changes: 7 additions & 7 deletions airflow/ui/openapi-gen/queries/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -651,22 +651,22 @@ export const UseDagStatsServiceGetDagStatsKeyFn = (
} = {},
queryKey?: Array<unknown>,
) => [useDagStatsServiceGetDagStatsKey, ...(queryKey ?? [{ dagIds }])];
export type DagReportServiceGetDagReportDefaultResponse = Awaited<
ReturnType<typeof DagReportService.getDagReport>
export type DagReportServiceGetDagReportsDefaultResponse = Awaited<
ReturnType<typeof DagReportService.getDagReports>
>;
export type DagReportServiceGetDagReportQueryResult<
TData = DagReportServiceGetDagReportDefaultResponse,
export type DagReportServiceGetDagReportsQueryResult<
TData = DagReportServiceGetDagReportsDefaultResponse,
TError = unknown,
> = UseQueryResult<TData, TError>;
export const useDagReportServiceGetDagReportKey = "DagReportServiceGetDagReport";
export const UseDagReportServiceGetDagReportKeyFn = (
export const useDagReportServiceGetDagReportsKey = "DagReportServiceGetDagReports";
export const UseDagReportServiceGetDagReportsKeyFn = (
{
subdir,
}: {
subdir: string;
},
queryKey?: Array<unknown>,
) => [useDagReportServiceGetDagReportKey, ...(queryKey ?? [{ subdir }])];
) => [useDagReportServiceGetDagReportsKey, ...(queryKey ?? [{ subdir }])];
export type DagWarningServiceListDagWarningsDefaultResponse = Awaited<
ReturnType<typeof DagWarningService.listDagWarnings>
>;
Expand Down
8 changes: 4 additions & 4 deletions airflow/ui/openapi-gen/queries/prefetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -889,14 +889,14 @@ export const prefetchUseDagStatsServiceGetDagStats = (
queryFn: () => DagStatsService.getDagStats({ dagIds }),
});
/**
* Get Dag Report
* Get Dag Reports
* Get DAG report.
* @param data The data for the request.
* @param data.subdir
* @returns unknown Successful Response
* @throws ApiError
*/
export const prefetchUseDagReportServiceGetDagReport = (
export const prefetchUseDagReportServiceGetDagReports = (
queryClient: QueryClient,
{
subdir,
Expand All @@ -905,8 +905,8 @@ export const prefetchUseDagReportServiceGetDagReport = (
},
) =>
queryClient.prefetchQuery({
queryKey: Common.UseDagReportServiceGetDagReportKeyFn({ subdir }),
queryFn: () => DagReportService.getDagReport({ subdir }),
queryKey: Common.UseDagReportServiceGetDagReportsKeyFn({ subdir }),
queryFn: () => DagReportService.getDagReports({ subdir }),
});
/**
* List Dag Warnings
Expand Down
10 changes: 5 additions & 5 deletions airflow/ui/openapi-gen/queries/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1077,15 +1077,15 @@ export const useDagStatsServiceGetDagStats = <
...options,
});
/**
* Get Dag Report
* Get Dag Reports
* Get DAG report.
* @param data The data for the request.
* @param data.subdir
* @returns unknown Successful Response
* @throws ApiError
*/
export const useDagReportServiceGetDagReport = <
TData = Common.DagReportServiceGetDagReportDefaultResponse,
export const useDagReportServiceGetDagReports = <
TData = Common.DagReportServiceGetDagReportsDefaultResponse,
TError = unknown,
TQueryKey extends Array<unknown> = unknown[],
>(
Expand All @@ -1098,8 +1098,8 @@ export const useDagReportServiceGetDagReport = <
options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">,
) =>
useQuery<TData, TError>({
queryKey: Common.UseDagReportServiceGetDagReportKeyFn({ subdir }, queryKey),
queryFn: () => DagReportService.getDagReport({ subdir }) as TData,
queryKey: Common.UseDagReportServiceGetDagReportsKeyFn({ subdir }, queryKey),
queryFn: () => DagReportService.getDagReports({ subdir }) as TData,
...options,
});
/**
Expand Down
10 changes: 5 additions & 5 deletions airflow/ui/openapi-gen/queries/suspense.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1056,15 +1056,15 @@ export const useDagStatsServiceGetDagStatsSuspense = <
...options,
});
/**
* Get Dag Report
* Get Dag Reports
* Get DAG report.
* @param data The data for the request.
* @param data.subdir
* @returns unknown Successful Response
* @throws ApiError
*/
export const useDagReportServiceGetDagReportSuspense = <
TData = Common.DagReportServiceGetDagReportDefaultResponse,
export const useDagReportServiceGetDagReportsSuspense = <
TData = Common.DagReportServiceGetDagReportsDefaultResponse,
TError = unknown,
TQueryKey extends Array<unknown> = unknown[],
>(
Expand All @@ -1077,8 +1077,8 @@ export const useDagReportServiceGetDagReportSuspense = <
options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">,
) =>
useSuspenseQuery<TData, TError>({
queryKey: Common.UseDagReportServiceGetDagReportKeyFn({ subdir }, queryKey),
queryFn: () => DagReportService.getDagReport({ subdir }) as TData,
queryKey: Common.UseDagReportServiceGetDagReportsKeyFn({ subdir }, queryKey),
queryFn: () => DagReportService.getDagReports({ subdir }) as TData,
...options,
});
/**
Expand Down
8 changes: 4 additions & 4 deletions airflow/ui/openapi-gen/requests/services.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ import type {
GetDagSourceResponse,
GetDagStatsData,
GetDagStatsResponse,
GetDagReportData,
GetDagReportResponse,
GetDagReportsData,
GetDagReportsResponse,
ListDagWarningsData,
ListDagWarningsResponse,
GetDagsData,
Expand Down Expand Up @@ -1524,14 +1524,14 @@ export class DagStatsService {

export class DagReportService {
/**
* Get Dag Report
* Get Dag Reports
* Get DAG report.
* @param data The data for the request.
* @param data.subdir
* @returns unknown Successful Response
* @throws ApiError
*/
public static getDagReport(data: GetDagReportData): CancelablePromise<GetDagReportResponse> {
public static getDagReports(data: GetDagReportsData): CancelablePromise<GetDagReportsResponse> {
return __request(OpenAPI, {
method: "GET",
url: "/public/dagReports",
Expand Down
6 changes: 3 additions & 3 deletions airflow/ui/openapi-gen/requests/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1877,11 +1877,11 @@ export type GetDagStatsData = {

export type GetDagStatsResponse = DagStatsCollectionResponse;

export type GetDagReportData = {
export type GetDagReportsData = {
subdir: string;
};

export type GetDagReportResponse = unknown;
export type GetDagReportsResponse = unknown;

export type ListDagWarningsData = {
dagId?: string | null;
Expand Down Expand Up @@ -3551,7 +3551,7 @@ export type $OpenApiTs = {
};
"/public/dagReports": {
get: {
req: GetDagReportData;
req: GetDagReportsData;
res: {
/**
* Successful Response
Expand Down
4 changes: 3 additions & 1 deletion tests/api_fastapi/core_api/routes/public/test_dag_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@


def get_corresponding_dag_file_count(dir: str, include_examples: bool = True) -> int:
from airflow import example_dags

return len(list_py_file_paths(directory=dir)) + (
len(list_py_file_paths("/opt/airflow/airflow/example_dags")) if include_examples else 0
len(list_py_file_paths(next(iter(example_dags.__path__)))) if include_examples else 0
)


Expand Down

0 comments on commit 9285cc7

Please sign in to comment.