Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18006eb0 authored by Xiao Ma's avatar Xiao Ma
Browse files

Cleanup testOverrideVendorId static member after running unittest.

"testOverrideVendorId" variable is just used in the DhcpPacket unit
test, we set it to "android-dhcp-???" to check whether the vendor id
sent in the packet is expected. However, in the code coverage test,
since it's static member, its value might affect the following test cases
which are checking "mVendorId" member(e.g. IpClientIntegrationTest),
depends on the execute order of test case. Hence, reset the
"testOverrideVendorId" variable after running unit test.

Bug: 169128961
Test: atest NetworkStackTests
Change-Id: If2a974cb7a9c1cbba57d49beef29736862b99232
parent 3c141ccc
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ import androidx.test.runner.AndroidJUnit4;

import com.android.internal.util.HexDump;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -98,6 +99,11 @@ public class DhcpPacketTest {
        DhcpPacket.testOverrideVendorId = "android-dhcp-???";
    }

    @After
    public void tearDown() {
        DhcpPacket.testOverrideVendorId = null;
    }

    class TestDhcpPacket extends DhcpPacket {
        private byte mType;
        // TODO: Make this a map of option numbers to bytes instead.