-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add test for unchanging NRF URI
- Loading branch information
1 parent
cbdd2b5
commit be89e02
Showing
2 changed files
with
39 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright 2023 Open Networking Foundation <[email protected]> | ||
// | ||
|
||
package service | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
"net/http/httptest" | ||
"testing" | ||
"time" | ||
|
||
"github.com/omec-project/udm/context" | ||
) | ||
|
||
func Test_nrf_url_is_not_overwritten_when_registering(t *testing.T) { | ||
svr := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||
fmt.Fprintf(w, "banana") | ||
})) | ||
svr.EnableHTTP2 = true | ||
svr.StartTLS() | ||
defer svr.Close() | ||
self := context.UDM_Self() | ||
self.NrfUri = svr.URL | ||
self.RegisterIPv4 = "127.0.0.2" | ||
var udm *UDM | ||
go udm.registerNF() | ||
ConfigPodTrigger <- true | ||
|
||
time.Sleep(1 * time.Second) | ||
if self.NrfUri != svr.URL { | ||
t.Errorf("Expected NRF URL to stay %v, but was %v", svr.URL, self.NrfUri) | ||
} | ||
} |