On Thu, Mar 30, 2023 at 8:54 AM Dumitru Ceara <[email protected]> wrote:
>
> On 3/29/23 16:01, [email protected] wrote:
> > From: Numan Siddique <[email protected]>
> >
> > This patch adds a couple of jobs using ovn-fake-multinode.
> > It first builds 2 ovn-fake-multinode container images
> >   - one with OVN 22.03
> >   - one with present main.
> >
> > The first job deploys ovn-fake-multinode with the main
> > OVN and runs simple tests provided by ovn-fake-multinode [1].
> >
> > The second job deploys ovn-fake-multinode setup with the
> > central image using OVN 22.03 and chassis image using main OVN.
> > This job tests the scenario
> >   - ovn-northd and OVN dbs are running the most recent LTS.
> >   - ovn-controller is running the latest commit from the branch.
> >
> > The workflow is right now scheduled to trigger on midnight everyday.
> > Once we cache the built image or reduce the overall run time of
> > this workflow we can enable for every push.
> >
> > [1] - 
> > https://github.com/ovn-org/ovn-fake-multinode/blob/main/.ci/test_basic.sh
> >
> > Signed-off-by: Numan Siddique <[email protected]>
> > ---
>
> I have a few minor comments, feel free to add my ack when you apply the
> patch if you address them:
>
> Acked-by: Dumitru Ceara <[email protected]>

Thanks Dumitru and Simon for the reviews.

It took a while for me to address the comments and apply.

I applied both the patches to the main branch with the below changes.

Also I had to add back the file .ci/linux-prepare.sh as the fake multi
node system tests would need to compile ovn.

I could have avoided that and instead  installed the
'linux-prepare.sh'  stuff in the workflow yaml file itself.
But I felt it easier to just add back the file.

Thanks
Numan



Patch 1
------------------

diff --git a/.github/workflows/ovn-fake-multinode-tests.yml
b/.github/workflows/ovn-fake-multinode-tests.yml
index fa768f235c..c5be7125e6 100644
--- a/.github/workflows/ovn-fake-multinode-tests.yml
+++ b/.github/workflows/ovn-fake-multinode-tests.yml
@@ -4,6 +4,7 @@ on:
   schedule:
     # Run everyday at midnight
     - cron: '0 0 * * *'
+  workflow_dispatch:

 concurrency:
   group: ${{ github.workflow }}-${{ github.event.pull_request.number
|| github.run_id }}
@@ -27,6 +28,9 @@ jobs:
         path: 'ovn-fake-multinode'
         ref: 'v0.1'

+    # Check out ovn and ovs separately inside ovn-fake-multinode/ovn
and ovn-fake-multinode/ovs
+    # ovn-fake-multinode builds and installs ovs from ovn-fake-multinode/ovs
+    # and it builds and installs ovn from ovn-fake-multinode/ovn. It
uses the ovs submodule for ovn compilation.
     - name: Check out ovn
       uses: actions/checkout@v3
       with:


Patch 2
------------------

diff --git a/.github/workflows/ovn-fake-multinode-tests.yml
b/.github/workflows/ovn-fake-multinode-tests.yml
index e79f68c226..015e5ac507 100644
--- a/.github/workflows/ovn-fake-multinode-tests.yml
+++ b/.github/workflows/ovn-fake-multinode-tests.yml
@@ -194,12 +194,7 @@ jobs:
         # files and we could have some socket files in testsuite.dir.
         # Also, upload-artifact@v3 doesn't work well enough with wildcards.
         # So, we're just archiving everything here to avoid any issues.
-        pwd
-        ls -l
         mkdir logs
-        ls -l ovn/
-        ls -l ovn/tests/
-
         cp ovn/config.log ./logs/
         # multinode tests are run as root, need to adjust permissions.
         sudo chmod -R +r ovn/tests/multinode-testsuite.dir.* || true
diff --git a/tests/multinode-macros.at b/tests/multinode-macros.at
index 1525442804..c04506a52a 100644
--- a/tests/multinode-macros.at
+++ b/tests/multinode-macros.at
@@ -50,7 +50,7 @@ multinode_nbctl () {
     m_as ovn-central ovn-nbctl "$@"
 }

-# count_rows TABLE [CONDITION...]
+# m_count_rows TABLE [CONDITION...]
 #
 # Prints the number of rows in TABLE (that satisfy CONDITION).
 # Uses the southbound db by default; set DB=nb for the northbound database.
@@ -59,7 +59,7 @@ m_count_rows() {
     m_central_as ovn-${db}ctl --format=table --no-headings find
$table "$@" | wc -l
 }

-# check_row_count [DATABASE:]TABLE COUNT [CONDITION...]
+# m_check_row_count [DATABASE:]TABLE COUNT [CONDITION...]
 #
 # Checks that TABLE contains COUNT rows (that satisfy CONDITION).
 # The default DATABASE is "sb".
@@ -75,7 +75,7 @@ m_check_row_count() {
     fi
 }

-# wait_row_count [DATABASE:]TABLE COUNT [CONDITION...]
+# m_wait_row_count [DATABASE:]TABLE COUNT [CONDITION...]
 #
 # Waits until TABLE contains COUNT rows (that satisfy CONDITION).
 # The default DATABASE is "sb".
@@ -89,7 +89,7 @@ m_wait_row_count() {
       m_central_as ovn-${db}ctl list $table])
 }

-# multinode_wait_column EXPECTED [DATABASE:]TABLE [COLUMN [CONDITION...]]
+# m_wait_column EXPECTED [DATABASE:]TABLE [COLUMN [CONDITION...]]
 #
 # Wait until all of the values of COLUMN in the rows of TABLE (that
 # satisfy CONDITION) equal EXPECTED (ignoring order).
@@ -113,7 +113,7 @@ m_wait_column() {
       m_central_as ovn-${db}ctl list $table])
 }

-# fetch_column [DATABASE:]TABLE COLUMN [CONDITION...]
+# m_fetch_column [DATABASE:]TABLE COLUMN [CONDITION...]
 #
 # Fetches and prints all the values of COLUMN in the rows of TABLE
 # (that satisfy CONDITION), sorting the results lexicographically.
@@ -124,7 +124,7 @@ m_fetch_column() {
     echo $(m_central_as ovn-${db}ctl --bare --columns $column find
$table "$@" | sort)
 }

-# check_column EXPECTED [DATABASE:]TABLE COLUMN [CONDITION...]
+# m_check_column EXPECTED [DATABASE:]TABLE COLUMN [CONDITION...]
 #
 # Fetches all of the values of COLUMN in the rows of TABLE (that
 # satisfy CONDITION), and compares them against EXPECTED (ignoring
@@ -147,31 +147,7 @@ m_check_column() {
     fi
 }

-# wait_column EXPECTED [DATABASE:]TABLE [COLUMN [CONDITION...]]
-#
-# Wait until all of the values of COLUMN in the rows of TABLE (that
-# satisfy CONDITION) equal EXPECTED (ignoring order).
-#
-# The default DATABASE is "sb".
-#
-# COLUMN defaults to _uuid if unspecified.
-m_wait_column() {
-    local expected=$(for d in $1; do echo $d; done | sort)
-    local db=$(parse_db $2) table=$(parse_table $2)
column=${3-_uuid}; shift; shift; shift
-    local a=$1 b=$2 c=$3 d=$4 e=$5
-
-    echo
-    echo "Waiting until $column in $db $table${1+ with $*} is $expected..."
-    OVS_WAIT_UNTIL([
-      found=$(m_central_as ovn-${db}ctl --bare --columns $column find
$table $a $b $c $d $e)
-      found=$(for d in $found; do echo $d; done | sort)
-      test "$expected" = "$found"
-    ], [
-      echo "$column in $db table $table has value $found, from the
following rows:"
-      m_central_as ovn-${db}ctl list $table])
-}
-
-# wait_for_ports_up [PORT...]
+# m_wait_for_ports_up [PORT...]
 #
 # With arguments, waits for specified Logical_Switch_Ports to come up.
 # Without arguments, waits for all "plain" and router



>
> Thanks,
> Dumitru
>
> >  .../workflows/ovn-fake-multinode-tests.yml    | 151 ++++++++++++++++++
> >  Makefile.am                                   |   1 +
> >  2 files changed, 152 insertions(+)
> >  create mode 100644 .github/workflows/ovn-fake-multinode-tests.yml
> >
> > diff --git a/.github/workflows/ovn-fake-multinode-tests.yml 
> > b/.github/workflows/ovn-fake-multinode-tests.yml
> > new file mode 100644
> > index 0000000000..fa768f235c
> > --- /dev/null
> > +++ b/.github/workflows/ovn-fake-multinode-tests.yml
> > @@ -0,0 +1,151 @@
> > +name: System tests using ovn-fake-multinode
> > +
> > +on:
>
> It might be good also add:
>
>   workflow_dispatch:
>
> So we can run the workflow on demand as well.
>
> > +  schedule:
> > +    # Run everyday at midnight
> > +    - cron: '0 0 * * *'
> > +
> > +concurrency:
> > +  group: ${{ github.workflow }}-${{ github.event.pull_request.number || 
> > github.run_id }}
> > +  cancel-in-progress: true
> > +
> > +jobs:
> > +  build:
> > +    env:
> > +      RUNC_CMD: podman
> > +      OS_IMAGE: "fedora:37"
> > +      # https://github.com/actions/runner-images/issues/6282
> > +      XDG_RUNTIME_DIR: ''
> > +
> > +    name: Build ovn-fake-multinode image
> > +    runs-on: ubuntu-20.04
> > +    steps:
> > +    - name: Check out ovn-fake-multi-node
> > +      uses: actions/checkout@v3
> > +      with:
> > +        repository: 'ovn-org/ovn-fake-multinode'
> > +        path: 'ovn-fake-multinode'
> > +        ref: 'v0.1'
> > +
> > +    - name: Check out ovn
> > +      uses: actions/checkout@v3
> > +      with:
> > +        path: 'ovn-fake-multinode/ovn'
> > +        submodules: recursive
> > +
> > +    - name: Check out ovs master
> > +      uses: actions/checkout@v3
> > +      with:
> > +        path: 'ovn-fake-multinode/ovs'
> > +        repository: 'openvswitch/ovs'
> > +        ref: 'master'
>
> This works fine because ovn-fake-multinode builds OVN against the
> version checked out in the submodule.  But it might not be obvious.
> Shall we add a comment before these two steps?
>
> > +
> > +    - name: Install dependencies
> > +      run: |
> > +        sudo apt update
> > +        sudo apt-get install -y podman
> > +
> > +    - name: Build ovn-fake-multi-node main image
> > +      run: |
> > +        set -x
> > +        sudo -E ./ovn_cluster.sh build
> > +        mkdir -p /tmp/_output
> > +        sudo podman save ovn/ovn-multi-node:latest > 
> > /tmp/_output/ovn_main_image.tar
> > +      working-directory: ovn-fake-multinode
> > +
> > +    - name: Checkout ovn branch-22.03
> > +      uses: actions/checkout@v3
> > +      with:
> > +        path: 'ovn-fake-multinode/ovn'
> > +        submodules: recursive
> > +        ref: 'branch-22.03'
> > +
> > +    - name: Build ovn-fake-multi-node 22.03 image
> > +      run: |
> > +        set -x
> > +        sudo -E ./ovn_cluster.sh build
> > +        mkdir -p /tmp/_output
> > +        sudo podman tag ovn/ovn-multi-node:latest ovn/ovn-multi-node:22.03
> > +        sudo podman save ovn/ovn-multi-node:22.03 > 
> > /tmp/_output/ovn_22_03_image.tar
> > +      working-directory: ovn-fake-multinode
> > +
> > +    - uses: actions/upload-artifact@v3
> > +      with:
> > +        name: test-main-image
> > +        path: /tmp/_output/ovn_main_image.tar
> > +
> > +    - uses: actions/upload-artifact@v3
> > +      with:
> > +        name: test-22-03-image
> > +        path: /tmp/_output/ovn_22_03_image.tar
> > +
> > +  multinode-tests:
> > +    runs-on: ubuntu-20.04
> > +    timeout-minutes: 15
> > +    env:
> > +      RUNC_CMD: podman
> > +      OS_IMAGE: "fedora:37"
> > +      CENTRAL_IMAGE: ${{ matrix.cfg.central_image }}
> > +      # Disable SSL for now. Revisit this if required.
> > +      ENABLE_SSL: no
> > +      # https://github.com/actions/runner-images/issues/6282
> > +      XDG_RUNTIME_DIR: ''
> > +
> > +    name: multinode tests ${{ join(matrix.cfg.*, ' ') }}
> > +    needs: [build]
> > +    strategy:
> > +      fail-fast: false
> > +      matrix:
> > +        cfg:
> > +        - { central_image: "ovn/ovn-multi-node:latest" }
> > +        - { central_image: "ovn/ovn-multi-node:22.03" }
> > +
> > +    steps:
> > +
> > +    - name: Free up disk space
> > +      run: sudo eatmydata apt-get remove --auto-remove -y aspnetcore-* 
> > dotnet-* libmono-* mono-* msbuild php-* php7* ghc-* zulu-*
> > +
> > +    - uses: actions/download-artifact@v3
> > +      with:
> > +        name: test-main-image
> > +
> > +    - uses: actions/download-artifact@v3
> > +      with:
> > +        name: test-22-03-image
> > +
> > +    - name: Load podman image
> > +      run: |
> > +        sudo podman load --input ovn_main_image.tar
> > +        sudo podman load --input ovn_22_03_image.tar
> > +
> > +    - name: Check out ovn-fake-multi-node
> > +      uses: actions/checkout@v3
> > +      with:
> > +        repository: 'ovn-org/ovn-fake-multinode'
> > +        path: 'ovn-fake-multinode'
> > +        ref: 'v0.1'
> > +
> > +    - name: Install dependencies
> > +      run: |
> > +        sudo apt update
> > +        sudo apt-get install -y podman openvswitch-switch
> > +        sudo systemctl start openvswitch-switch
> > +        sudo ovs-vsctl show
> > +
> > +    - name: Start basic cluster
> > +      run: |
> > +        sudo -E ./ovn_cluster.sh start
> > +        sudo podman exec -it ovn-central ovn-nbctl show
> > +        sudo podman exec -it ovn-central ovn-appctl -t ovn-northd version
> > +        sudo podman exec -it ovn-chassis-1 ovn-appctl -t ovn-controller 
> > version
> > +      working-directory: ovn-fake-multinode
> > +
> > +    - name: Run basic test script
> > +      run: |
> > +        sudo ./.ci/test_basic.sh
> > +      working-directory: ovn-fake-multinode
> > +
> > +    - name: Stop cluster
> > +      run: |
> > +        sudo -E ./ovn_cluster.sh stop
> > +      working-directory: ovn-fake-multinode
>
> Do we really need to stop the cluster? :)
>
> > diff --git a/Makefile.am b/Makefile.am
> > index 8c60d4a719..6d84888a29 100644
> > --- a/Makefile.am
> > +++ b/Makefile.am
> > @@ -95,6 +95,7 @@ EXTRA_DIST = \
> >       .ci/ovn-kubernetes/custom.patch \
> >       .github/workflows/test.yml \
> >       .github/workflows/ovn-kubernetes.yml \
> > +     .github/workflows/ovn-fake-multinode-tests.yml \
> >       boot.sh \
> >       $(MAN_FRAGMENTS) \
> >       $(MAN_ROOTS) \
>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to